Class JacksonObjectMapperProvider

  • All Implemented Interfaces:
    Extension

    public final class JacksonObjectMapperProvider
    extends java.lang.Object
    implements Extension
    Registry of shared ObjectMapper instances, each with it's unique bindingName.
    • Constructor Detail

      • JacksonObjectMapperProvider

        public JacksonObjectMapperProvider​(ExtendedActorSystem system)
    • Method Detail

      • configForBinding

        public static com.typesafe.config.Config configForBinding​(java.lang.String bindingName,
                                                                  com.typesafe.config.Config systemConfig)
        The configuration for a given bindingName.
        Parameters:
        bindingName - (undocumented)
        systemConfig - (undocumented)
        Returns:
        (undocumented)
      • createObjectMapper

        public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper​(java.lang.String bindingName,
                                                                                     scala.Option<com.fasterxml.jackson.core.JsonFactory> jsonFactory,
                                                                                     JacksonObjectMapperFactory objectMapperFactory,
                                                                                     com.typesafe.config.Config config,
                                                                                     DynamicAccess dynamicAccess,
                                                                                     scala.Option<LoggingAdapter> log)
        INTERNAL API: Use create(java.lang.String, scala.Option<com.fasterxml.jackson.core.JsonFactory>)

        This is needed by one test in Lagom where the ObjectMapper is created without starting and ActorSystem.

        Parameters:
        bindingName - (undocumented)
        jsonFactory - (undocumented)
        objectMapperFactory - (undocumented)
        config - (undocumented)
        dynamicAccess - (undocumented)
        log - (undocumented)
        Returns:
        (undocumented)
      • apply

        public static T apply​(ActorSystem system)
      • hashCode

        public static final int hashCode()
      • equals

        public static final boolean equals​(java.lang.Object other)
      • getOrCreate

        public com.fasterxml.jackson.databind.ObjectMapper getOrCreate​(java.lang.String bindingName,
                                                                       scala.Option<com.fasterxml.jackson.core.JsonFactory> jsonFactory)
        Scala API: Returns an existing Jackson ObjectMapper that was created previously with this method, or creates a new instance.

        The ObjectMapper is created with sensible defaults and modules configured in akka.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such ActorSystemSetup.

        The returned ObjectMapper must not be modified, because it may already be in use and such modifications are not thread-safe.

        Parameters:
        bindingName - name of this ObjectMapper
        jsonFactory - optional JsonFactory such as CBORFactory, for plain JSON None (defaults) can be used
        Returns:
        (undocumented)
      • getOrCreate

        public com.fasterxml.jackson.databind.ObjectMapper getOrCreate​(java.lang.String bindingName,
                                                                       java.util.Optional<com.fasterxml.jackson.core.JsonFactory> jsonFactory)
        Java API: Returns an existing Jackson ObjectMapper that was created previously with this method, or creates a new instance.

        The ObjectMapper is created with sensible defaults and modules configured in akka.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such ActorSystemSetup.

        The returned ObjectMapper must not be modified, because it may already be in use and such modifications are not thread-safe.

        Parameters:
        bindingName - name of this ObjectMapper
        jsonFactory - optional JsonFactory such as CBORFactory, for plain JSON None (defaults) can be used
        Returns:
        (undocumented)
      • create

        public com.fasterxml.jackson.databind.ObjectMapper create​(java.lang.String bindingName,
                                                                  scala.Option<com.fasterxml.jackson.core.JsonFactory> jsonFactory)
        Scala API: Creates a new instance of a Jackson ObjectMapper with sensible defaults and modules configured in akka.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such ActorSystemSetup.

        Parameters:
        bindingName - name of this ObjectMapper
        jsonFactory - optional JsonFactory such as CBORFactory, for plain JSON None (defaults) can be used
        Returns:
        (undocumented)
        See Also:
        getOrCreate(java.lang.String, scala.Option<com.fasterxml.jackson.core.JsonFactory>)
      • create

        public com.fasterxml.jackson.databind.ObjectMapper create​(java.lang.String bindingName,
                                                                  java.util.Optional<com.fasterxml.jackson.core.JsonFactory> jsonFactory)
        Java API: Creates a new instance of a Jackson ObjectMapper with sensible defaults and modules configured in akka.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such ActorSystemSetup.

        Parameters:
        bindingName - name of this ObjectMapper
        jsonFactory - optional JsonFactory such as CBORFactory, for plain JSON None (defaults) can be used
        Returns:
        (undocumented)
        See Also:
        getOrCreate(java.lang.String, scala.Option<com.fasterxml.jackson.core.JsonFactory>)