class MastershipRoleCodec extends JsonCodec<MastershipRole> {

    @Override
    public ObjectNode encode(MastershipRole mastershipRole, CodecContext context) {
        checkNotNull(mastershipRole, "MastershipRole cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put(ROLE, mastershipRole.name());
        return result;
    }

}