Class ObjectMappers

java.lang.Object
com.palantir.conjure.java.serialization.ObjectMappers

public final class ObjectMappers extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.dataformat.cbor.CBORFactory
    Creates a new CBORFactory configured with Conjure defaults.
    static com.fasterxml.jackson.core.JsonFactory
    Creates a new JsonFactory configured with Conjure defaults.
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper
    Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.
    static com.fasterxml.jackson.databind.json.JsonMapper
    Returns a default ObjectMapper with settings adjusted for use in clients.
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.dataformat.smile.databind.SmileMapper
    Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients.
    static com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper
    Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in servers.
    static com.fasterxml.jackson.databind.json.JsonMapper
    Returns a default ObjectMapper with settings adjusted for use in servers.
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.dataformat.smile.databind.SmileMapper
    Returns a default ObjectMapper which uses the smile factory with settings adjusted for use in servers.
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.dataformat.smile.SmileFactory
    Creates a new SmileFactory configured with Conjure defaults.
    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.
    static com.fasterxml.jackson.databind.ObjectMapper
    withDefaultModules(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Configures provided ObjectMapper with default modules and settings.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 new JsonFactory configured with Conjure defaults.
    • smileFactory

      public static com.fasterxml.jackson.dataformat.smile.SmileFactory smileFactory()
      Creates a new SmileFactory configured with Conjure defaults.
    • cborFactory

      public static com.fasterxml.jackson.dataformat.cbor.CBORFactory cborFactory()
      Creates a new CBORFactory configured with Conjure defaults.