use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ReferenceConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new NamspaceRefAdapter());
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class RouteConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new RouteAdapter().adaptType("test"));
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project alias by JohT.
the class TypeReferenceEnhancementIntegrationTest method includedNullValuesDeserializable.
@Test
public void includedNullValuesDeserializable() {
new TestJsonbConfigProvider().joinConfig(new JsonbConfig().withNullValues(Boolean.TRUE));
Animal nullContent = new Monkey(null);
assertEquals(nullContent, serializeAndDeserialize(nullContent));
}
use of jakarta.json.bind.JsonbConfig in project alias by JohT.
the class TypeReferenceEnhancementIntegrationTest method serializeAndDeserialize.
@SuppressWarnings("unchecked")
private <T> T serializeAndDeserialize(T object) {
JsonbConfig config = new TestJsonbConfigProvider().getJsonbConfig();
Jsonb jsonb = JsonbBuilder.create(config);
String json = printed(jsonb.toJson(object));
return (T) jsonb.fromJson(json, object.getClass());
}
use of jakarta.json.bind.JsonbConfig in project alias by JohT.
the class ImmutableJsonbConfig method join.
/**
* Returns a new {@link JsonbConfig} that combines the settings of the given {@link JsonbConfig} <br>
* and this {@link ImmutableJsonbConfig}.
*
* @param configToJoin {@link JsonbConfig}
* @return {@link JsonbConfig}
*/
public JsonbConfig join(JsonbConfig configToJoin) {
JsonbConfig joinedConfig = getJsonbConfig();
configToJoin.getAsMap().forEach(joinPropertyInto(joinedConfig));
return joinedConfig;
}
Aggregations