Class JacksonConfiguration

java.lang.Object
io.micronaut.jackson.JacksonConfiguration
All Implemented Interfaces:
JsonConfiguration

@ConfigurationProperties("jackson") public class JacksonConfiguration extends Object implements JsonConfiguration
Configuration for the Jackson JSON parser.
Since:
1.0
Author:
Graeme Rocher
  • Field Details

    • DEFAULT_ARRAYSIZETHRESHOLD

      public static final int DEFAULT_ARRAYSIZETHRESHOLD
      The default array size threshold value.
      See Also:
    • PROPERTY_MODULE_SCAN

      public static final String PROPERTY_MODULE_SCAN
      The property used to enable module scan.
      See Also:
    • PROPERTY_USE_BEAN_INTROSPECTION

      public static final String PROPERTY_USE_BEAN_INTROSPECTION
      The property used to enable bean introspection.
      See Also:
  • Constructor Details

    • JacksonConfiguration

      public JacksonConfiguration()
  • Method Details

    • isBeanIntrospectionModule

      public boolean isBeanIntrospectionModule()
      Whether the BeanIntrospection should be used for reflection free object serialialization/deserialialization.
      Returns:
      True if it should
    • setBeanIntrospectionModule

      public void setBeanIntrospectionModule(boolean beanIntrospectionModule)
      Whether the BeanIntrospection should be used for reflection free object serialialization/deserialialization.
      Parameters:
      beanIntrospectionModule - True if it should
    • isModuleScan

      public boolean isModuleScan()
      Whether Jackson modules should be scanned for.
      Returns:
      True if module scanning is enabled
    • setModuleScan

      public void setModuleScan(boolean moduleScan)
      Sets whether to scan for modules or not (defaults to true).
      Parameters:
      moduleScan - True if module scan should be enabled
    • getSerializationInclusion

      public com.fasterxml.jackson.annotation.JsonInclude.Include getSerializationInclusion()
      Returns:
      The default serialization inclusion settings
    • getDefaultTyping

      public com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping getDefaultTyping()
      Returns:
      The global defaultTyping using for Polymorphic handling
    • getLocale

      public Locale getLocale()
      Returns:
      The default locale to use
    • getTimeZone

      public TimeZone getTimeZone()
      Returns:
      The default time zone to use
    • getDateFormat

      public String getDateFormat()
      Returns:
      The date format to use for dates
    • getSerializationSettings

      public Map<com.fasterxml.jackson.databind.SerializationFeature,Boolean> getSerializationSettings()
      Returns:
      The serialization settings
    • getDeserializationSettings

      public Map<com.fasterxml.jackson.databind.DeserializationFeature,Boolean> getDeserializationSettings()
      Returns:
      The deserialization settings
    • getMapperSettings

      public Map<com.fasterxml.jackson.databind.MapperFeature,Boolean> getMapperSettings()
      Returns:
      Settings for the object mapper
    • getParserSettings

      public Map<com.fasterxml.jackson.core.JsonParser.Feature,Boolean> getParserSettings()
      Returns:
      Settings for the parser
    • getGeneratorSettings

      public Map<com.fasterxml.jackson.core.JsonGenerator.Feature,Boolean> getGeneratorSettings()
      Returns:
      Settings for the generator
    • getFactorySettings

      public Map<com.fasterxml.jackson.core.JsonFactory.Feature,Boolean> getFactorySettings()
      Returns:
      Settings for the factory
    • getArraySizeThreshold

      public int getArraySizeThreshold()
      Specified by:
      getArraySizeThreshold in interface JsonConfiguration
      Returns:
      The array size threshold to use when using Jackson for data binding
    • getPropertyNamingStrategy

      public com.fasterxml.jackson.databind.PropertyNamingStrategy getPropertyNamingStrategy()
      Returns:
      The property naming strategy
    • isAlwaysSerializeErrorsAsList

      public boolean isAlwaysSerializeErrorsAsList()
      Whether _embedded.errors should always be serialized as list. If set to false, _embedded.errors with 1 element will be serialized as an object.
      Specified by:
      isAlwaysSerializeErrorsAsList in interface JsonConfiguration
      Returns:
      True if _embedded.errors should always be serialized as list.
    • isTrimStrings

      public boolean isTrimStrings()
      Whether strings should be trimmed when deserializing. If the resulting string is an empty string, then null will be applied instead.
      Returns:
      True if strings should be trimmed when deserializing.
    • setDateFormat

      public void setDateFormat(String dateFormat)
      Sets the default date format to use.
      Parameters:
      dateFormat - The date format
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale to use.
      Parameters:
      locale - The locale
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
      Sets the timezone to use.
      Parameters:
      timeZone - The timezone
    • setArraySizeThreshold

      public void setArraySizeThreshold(int arraySizeThreshold)
      Sets the array size threshold for data binding. Default value (100).
      Parameters:
      arraySizeThreshold - The array size threshold
    • setSerialization

      public void setSerialization(Map<com.fasterxml.jackson.databind.SerializationFeature,Boolean> serialization)
      Sets the serialization features to use.
      Parameters:
      serialization - The serialization features.
    • setDeserialization

      public void setDeserialization(Map<com.fasterxml.jackson.databind.DeserializationFeature,Boolean> deserialization)
      Sets the deserialization features to use.
      Parameters:
      deserialization - The deserialiation features.
    • setMapper

      public void setMapper(Map<com.fasterxml.jackson.databind.MapperFeature,Boolean> mapper)
      Sets the object mapper features to use.
      Parameters:
      mapper - The object mapper features
    • setParser

      public void setParser(Map<com.fasterxml.jackson.core.JsonParser.Feature,Boolean> parser)
      Sets the parser features to use.
      Parameters:
      parser - The parser features
    • setGenerator

      public void setGenerator(Map<com.fasterxml.jackson.core.JsonGenerator.Feature,Boolean> generator)
      Sets the generator features to use.
      Parameters:
      generator - The generator features
    • setFactory

      public void setFactory(Map<com.fasterxml.jackson.core.JsonFactory.Feature,Boolean> factory)
      Sets the factory features to use.
      Parameters:
      factory - The generator features
    • setSerializationInclusion

      public void setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include serializationInclusion)
      Sets the serialization inclusion mode.
      Parameters:
      serializationInclusion - The serialization inclusion mode
    • setDefaultTyping

      public void setDefaultTyping(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping defaultTyping)
      Sets the global defaultTyping using for Polymorphic handling.
      Parameters:
      defaultTyping - The defaultTyping
    • setPropertyNamingStrategy

      public void setPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategy propertyNamingStrategy)
      Sets the property naming strategy.
      Parameters:
      propertyNamingStrategy - The property naming strategy
    • setAlwaysSerializeErrorsAsList

      public void setAlwaysSerializeErrorsAsList(boolean alwaysSerializeErrorsAsList)
      Sets whether _embedded.errors should always be serialized as list (defaults to false). If set to false, _embedded.errors with 1 element will be serialized as an object.
      Parameters:
      alwaysSerializeErrorsAsList - True if _embedded.errors should always be serialized as list
    • setTrimStrings

      public void setTrimStrings(boolean trimStrings)
      Whether strings should be trimmed when deserializing (defaults to false). If the resulting string is an empty string, then null will be applied instead.
      Parameters:
      trimStrings - True if strings should be trimmed when deserializing
    • constructType

      public static <T> com.fasterxml.jackson.databind.JavaType constructType(@NonNull @NonNull Argument<T> type, @NonNull @NonNull com.fasterxml.jackson.databind.type.TypeFactory typeFactory)
      Constructors a JavaType for the given argument and type factory.
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      typeFactory - The type factory
      Returns:
      The JavaType