static JsonObject fromJson(final JsonObject criteria, final String pojo) { final Mojo mojo = Mirror.create(From.class).mount(pojo).mojo(); return Query.criteria(criteria, mojo); } }
static JsonObject fromJson(final JsonObject criteria, final String pojo) { final Mojo mojo = Mirror.create(From.class).mount(pojo).mojo(); return Query.criteria(criteria, mojo); } }
static <T> JsonObject toJson( final T entity, final String pojo) { return Fn.getNull(new JsonObject(), () -> Fn.getSemi(Ut.isNil(pojo), null, () -> Ut.serializeJson(entity), () -> Mirror.create(To.class) .mount(pojo) .connect(Ut.serializeJson(entity)) .to().result()), entity); }
static <T> JsonObject toJson( final T entity, final String pojo) { return Fn.getNull(new JsonObject(), () -> Fn.getSemi(Ut.isNil(pojo), null, () -> Ut.serializeJson(entity), () -> Mirror.create(To.class) .mount(pojo) .connect(Ut.serializeJson(entity)) .to().result()), entity); }
void bind(final String pojo, final Class<?> clazz) { if (Ut.isNil(pojo)) { this.pojoFile = null; this.pojo = null; } else { LOGGER.debug(Info.JOOQ_BIND, pojo, clazz); this.pojoFile = pojo; this.pojo = Mirror.create(UxJooq.class).mount(pojo) .mojo().put(this.mapping); // When bind pojo, the system will analyze columns LOGGER.debug(Info.JOOQ_MOJO, this.pojo.getRevert(), this.pojo.getColumns()); } }
void bind(final String pojo, final Class<?> clazz) { if (Ut.isNil(pojo)) { this.pojoFile = null; this.pojo = null; } else { LOGGER.debug(Info.JOOQ_BIND, pojo, clazz); this.pojoFile = pojo; this.pojo = Mirror.create(UxJooq.class).mount(pojo) .mojo().put(this.mapping); // When bind pojo, the system will analyze columns LOGGER.debug(Info.JOOQ_MOJO, this.pojo.getRevert(), this.pojo.getColumns()); } }
static Inquiry getInquiry(final JsonObject envelop, final String pojo) { return Fn.getNull(Inquiry.create(new JsonObject()), () -> { final JsonObject data = envelop.copy(); if (Ut.isNil(pojo)) { return Inquiry.create(data); } else { // Projection Process final Mojo mojo = Mirror.create(Query.class).mount(pojo).mojo(); if (data.containsKey("projection")) { data.put("projection", projection(data.getJsonArray("projection"), mojo)); } if (data.containsKey("sorter")) { data.put("sorter", sorter(data.getJsonArray("sorter"), mojo)); } if (data.containsKey("criteria")) { data.put("criteria", criteria(data.getJsonObject("criteria"), mojo)); } LOGGER.info(Info.INQUIRY_MESSAGE, data.encode()); return Inquiry.create(data); } }, envelop); }
static Inquiry getInquiry(final JsonObject envelop, final String pojo) { return Fn.getNull(Inquiry.create(new JsonObject()), () -> { final JsonObject data = envelop.copy(); if (Ut.isNil(pojo)) { return Inquiry.create(data); } else { // Projection Process final Mojo mojo = Mirror.create(Query.class).mount(pojo).mojo(); if (data.containsKey("projection")) { data.put("projection", projection(data.getJsonArray("projection"), mojo)); } if (data.containsKey("sorter")) { data.put("sorter", sorter(data.getJsonArray("sorter"), mojo)); } if (data.containsKey("criteria")) { data.put("criteria", criteria(data.getJsonObject("criteria"), mojo)); } LOGGER.info(Info.INQUIRY_MESSAGE, data.encode()); return Inquiry.create(data); } }, envelop); }
static <T> T fromJson(final JsonObject data, final Class<T> clazz, final String pojo) { return Fn.getNull(Ut.instance(clazz), () -> Fn.getSemi(Ut.isNil(pojo), null, () -> Ut.deserialize(data, clazz), () -> Mirror.create(From.class) .mount(pojo) .connect(data) .type(clazz) .from() .get()), pojo); }
static <T> T fromJson(final JsonObject data, final Class<T> clazz, final String pojo) { return Fn.getNull(Ut.instance(clazz), () -> Fn.getSemi(Ut.isNil(pojo), null, () -> Ut.deserialize(data, clazz), () -> Mirror.create(From.class) .mount(pojo) .connect(data) .type(clazz) .from() .get()), pojo); }