Class ObjectMappers
java.lang.Object
com.palantir.conjure.java.serialization.ObjectMappers
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.dataformat.cbor.CBORFactoryCreates a newCBORFactoryconfigured with Conjure defaults.static com.fasterxml.jackson.core.JsonFactoryCreates a newJsonFactoryconfigured with Conjure defaults.static com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.dataformat.cbor.databind.CBORMapperReturns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.static com.fasterxml.jackson.databind.json.JsonMapperReturns a default ObjectMapper with settings adjusted for use in clients.static com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.dataformat.smile.databind.SmileMapperReturns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.static com.fasterxml.jackson.dataformat.cbor.databind.CBORMapperReturns a default ObjectMapper which uses the cbor factory with settings adjusted for use in servers.static com.fasterxml.jackson.databind.json.JsonMapperReturns a default ObjectMapper with settings adjusted for use in servers.static com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.dataformat.smile.databind.SmileMapperReturns a default ObjectMapper which uses the smile factory with settings adjusted for use in servers.static com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.dataformat.smile.SmileFactoryCreates a newSmileFactoryconfigured with Conjure defaults.static <M extends com.fasterxml.jackson.databind.ObjectMapper, B extends com.fasterxml.jackson.databind.cfg.MapperBuilder<M,B>>
BwithDefaultModules(B builder) Configures provided MapperBuilder with default modules and settings.static com.fasterxml.jackson.databind.ObjectMapperwithDefaultModules(com.fasterxml.jackson.databind.ObjectMapper mapper) Configures provided ObjectMapper with default modules and settings.
-
Method Details
-
newClientJsonMapper
public static com.fasterxml.jackson.databind.json.JsonMapper newClientJsonMapper()Returns a default ObjectMapper with settings adjusted for use in clients.Settings:
- Ignore unknown properties found during deserialization.
-
newClientCborMapper
public static com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper newClientCborMapper()Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.Settings:
- Ignore unknown properties found during deserialization.
-
newClientSmileMapper
public static com.fasterxml.jackson.dataformat.smile.databind.SmileMapper newClientSmileMapper()Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.Settings:
- Disable 7-bit binary encoding.
- Ignore unknown properties found during deserialization.
-
newServerJsonMapper
public static com.fasterxml.jackson.databind.json.JsonMapper newServerJsonMapper()Returns a default ObjectMapper with settings adjusted for use in servers.Settings:
- Throw on unknown properties found during deserialization.
-
newServerCborMapper
public static com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper newServerCborMapper()Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in servers.Settings:
- Throw on unknown properties found during deserialization.
-
newServerSmileMapper
public static com.fasterxml.jackson.dataformat.smile.databind.SmileMapper newServerSmileMapper()Returns a default ObjectMapper which uses the smile factory with settings adjusted for use in servers.Settings:
- Disable 7-bit binary encoding.
- Throw on unknown properties found during deserialization.
-
newClientObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newClientObjectMapper() -
newCborClientObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newCborClientObjectMapper() -
newSmileClientObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newSmileClientObjectMapper() -
newServerObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newServerObjectMapper() -
newCborServerObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newCborServerObjectMapper() -
newSmileServerObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper newSmileServerObjectMapper() -
withDefaultModules
public static <M extends com.fasterxml.jackson.databind.ObjectMapper, B extends com.fasterxml.jackson.databind.cfg.MapperBuilder<M,B>> B withDefaultModules(B builder) Configures provided MapperBuilder with default modules and settings.Modules: Guava, JDK7, JDK8, Afterburner, JavaTime, Joda
Settings:
- Dates written as ISO-8601 strings.
- Dates remain in received timezone.
- Exceptions will not be wrapped with Jackson exceptions.
- Deserializing a null for a primitive field will throw an exception.
-
withDefaultModules
public static com.fasterxml.jackson.databind.ObjectMapper withDefaultModules(com.fasterxml.jackson.databind.ObjectMapper mapper) Configures provided ObjectMapper with default modules and settings.Modules: Guava, JDK7, JDK8, Afterburner, JavaTime, Joda
Settings:
- Dates written as ISO-8601 strings.
- Dates remain in received timezone.
- Exceptions will not be wrapped with Jackson exceptions.
- Deserializing a null for a primitive field will throw an exception.
-
jsonFactory
public static com.fasterxml.jackson.core.JsonFactory jsonFactory()Creates a newJsonFactoryconfigured with Conjure defaults. -
smileFactory
public static com.fasterxml.jackson.dataformat.smile.SmileFactory smileFactory()Creates a newSmileFactoryconfigured with Conjure defaults. -
cborFactory
public static com.fasterxml.jackson.dataformat.cbor.CBORFactory cborFactory()Creates a newCBORFactoryconfigured with Conjure defaults.
-