Class JacksonObjectMapperProvider

java.lang.Object
org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider
All Implemented Interfaces:
Extension

public final class JacksonObjectMapperProvider extends Object implements Extension
Registry of shared ObjectMapper instances, each with its unique bindingName.
  • Constructor Details

  • Method Details

    • get

      public static JacksonObjectMapperProvider get(ActorSystem system)
    • get

    • lookup

      public static JacksonObjectMapperProvider$ lookup()
    • createExtension

      public static JacksonObjectMapperProvider createExtension(ExtendedActorSystem system)
    • configForBinding

      public static com.typesafe.config.Config configForBinding(String bindingName, com.typesafe.config.Config systemConfig)
      The configuration for a given bindingName.
    • createObjectMapper

      public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper(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.

    • apply

      public static T apply(ActorSystem system)
    • apply

      public static T apply(ClassicActorSystemProvider system)
    • hashCode

      public static final int hashCode()
    • equals

      public static final boolean equals(Object other)
    • getOrCreate

      public com.fasterxml.jackson.databind.ObjectMapper getOrCreate(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 pekko.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such pekko.actor.setup.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
    • getOrCreate

      public com.fasterxml.jackson.databind.ObjectMapper getOrCreate(String bindingName, 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 pekko.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such pekko.actor.setup.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
    • create

      public com.fasterxml.jackson.databind.ObjectMapper create(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 pekko.serialization.jackson.jackson-modules. It's using JacksonObjectMapperProviderSetup if the ActorSystem is started with such pekko.actor.setup.ActorSystemSetup.

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

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

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