private Object map(final Object next) { if (next == null || Record.class.isInstance(next)) { // directly ok return next; } if (String.class.isInstance(next) || next.getClass().isPrimitive()) { // primitives return next; } if (jsonb == null) { synchronized (this) { if (jsonb == null) { jsonb = JsonbBuilder .create(new JsonbConfig() .withAdapters(new MultipleFormatDateAdapter()) .setProperty("johnzon.cdi.activated", false)); } } } return new RecordConverters() .toRecord(next, () -> jsonb, () -> ComponentManager.instance().getRecordBuilderFactoryProvider().apply(null)); } }
jsonb = JsonbBuilder .create(new JsonbConfig() .withAdapters(new MultipleFormatDateAdapter()) .setProperty("johnzon.cdi.activated", false));
private Jsonb jsonb() { if (jsonb == null) { synchronized (this) { if (jsonb == null) { jsonb = ContainerFinder.Instance.get().find(plugin()).findService(Jsonb.class); } if (jsonb == null) { // for tests mainly jsonb = JsonbBuilder .create(new JsonbConfig() .withAdapters(new MultipleFormatDateAdapter()) .withBinaryDataStrategy(BinaryDataStrategy.BASE_64)); } } } return jsonb; }