Class ObjectMappers

java.lang.Object
dev.enola.common.jackson.ObjectMappers

public final class ObjectMappers extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.fasterxml.jackson.databind.ObjectMapper
    A shared, thread-safe, "immutable" default JSON ObjectMapper instance.
    static final com.fasterxml.jackson.databind.ObjectMapper
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    configure(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Configure the given ObjectMapper with Enola-specific settings.
    static com.fasterxml.jackson.databind.ObjectMapper
    Creates a new JSON ObjectMapper pre-configured with Enola defaults.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • JSON

      public static final com.fasterxml.jackson.databind.ObjectMapper JSON
      A shared, thread-safe, "immutable" default JSON ObjectMapper instance.

      This instance MUST NOT be reconfigured (e.g. by calling ObjectMapper.configure(com.fasterxml.jackson.databind.DeserializationFeature, boolean) or similar methods) because it is shared.

      If you need a specific configuration, use newJsonObjectMapper() to obtain a separate new instance, configure it, and then keep it for re-use.

    • YAML

      public static final com.fasterxml.jackson.databind.ObjectMapper YAML
  • Method Details

    • newJsonObjectMapper

      public static com.fasterxml.jackson.databind.ObjectMapper newJsonObjectMapper()
      Creates a new JSON ObjectMapper pre-configured with Enola defaults.

      The returned instance is a new separate object which can be safely re-configured (e.g. to set DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES to false).

      It is recommended to keep and re-use the obtained instance for performance reasons.

    • configure

      public static void configure(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Configure the given ObjectMapper with Enola-specific settings.