Class JacksonObjectMapperProvider

  • All Implemented Interfaces:
    Extension

    public final class JacksonObjectMapperProvider
    extends java.lang.Object
    implements Extension
    Registry of shared ObjectMapper instances, each with its 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.
      • 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 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​(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 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​(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 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:
        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 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:
        getOrCreate(java.lang.String, scala.Option<com.fasterxml.jackson.core.JsonFactory>)