Class ObjectMapperFactory

java.lang.Object
io.micronaut.jackson.ObjectMapperFactory

@Factory public class ObjectMapperFactory extends Object
Factory bean for creating the Jackson ObjectMapper.
Since:
1.0
Author:
Graeme Rocher
  • Field Details

    • MICRONAUT_MODULE

      public static final String MICRONAUT_MODULE
      Name for Micronaut module.
      See Also:
    • conversionService

      @Inject protected ConversionService conversionService
    • jacksonModules

      @Inject protected com.fasterxml.jackson.databind.Module[] jacksonModules
    • serializers

      @Inject protected com.fasterxml.jackson.databind.JsonSerializer[] serializers
    • deserializers

      @Inject protected com.fasterxml.jackson.databind.JsonDeserializer[] deserializers
    • beanSerializerModifiers

      @Inject protected com.fasterxml.jackson.databind.ser.BeanSerializerModifier[] beanSerializerModifiers
    • beanDeserializerModifiers

      @Inject protected com.fasterxml.jackson.databind.deser.BeanDeserializerModifier[] beanDeserializerModifiers
    • keyDeserializers

      @Inject protected com.fasterxml.jackson.databind.KeyDeserializer[] keyDeserializers
  • Constructor Details

    • ObjectMapperFactory

      public ObjectMapperFactory()
  • Method Details

    • jsonFactory

      @Requires(beans=JacksonConfiguration.class) @Singleton public com.fasterxml.jackson.core.JsonFactory jsonFactory(JacksonConfiguration jacksonConfiguration)
      Builds default Factory JsonFactory using properties from JacksonConfiguration.
      Parameters:
      jacksonConfiguration - The configuration
      Returns:
      The JsonFactory
    • setSerializers

      public void setSerializers(com.fasterxml.jackson.databind.JsonSerializer... serializers)
      Set additional serializers.
      Parameters:
      serializers - The serializers
      Since:
      4.0
    • setDeserializers

      public void setDeserializers(com.fasterxml.jackson.databind.JsonDeserializer... deserializers)
      Set additional deserializers.
      Parameters:
      deserializers - The deserializers
      Since:
      4.0
    • objectMapper

      @Singleton @Primary @Named("json") public com.fasterxml.jackson.databind.ObjectMapper objectMapper(@Nullable @Nullable JacksonConfiguration jacksonConfiguration, @Nullable @Nullable com.fasterxml.jackson.core.JsonFactory jsonFactory)
      Builds the core Jackson ObjectMapper from the optional configuration and JsonFactory.
      Parameters:
      jacksonConfiguration - The configuration
      jsonFactory - The JSON factory
      Returns:
      The ObjectMapper