Package io.micronaut.jackson
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 SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> com.fasterxml.jackson.databind.JavaTypeconstructType(@NonNull Argument<T> type, @NonNull com.fasterxml.jackson.databind.type.TypeFactory typeFactory) Constructors a JavaType for the given argument and type factory.intcom.fasterxml.jackson.databind.ObjectMapper.DefaultTypingcom.fasterxml.jackson.databind.PropertyNamingStrategycom.fasterxml.jackson.annotation.JsonInclude.IncludebooleanWhether _embedded.errors should always be serialized as list.booleanWhether theBeanIntrospectionshould be used for reflection free object serialialization/deserialialization.booleanWhether Jackson modules should be scanned for.booleanWhether strings should be trimmed when deserializing.voidsetAlwaysSerializeErrorsAsList(boolean alwaysSerializeErrorsAsList) Sets whether _embedded.errors should always be serialized as list (defaults to false).voidsetArraySizeThreshold(int arraySizeThreshold) Sets the array size threshold for data binding.voidsetBeanIntrospectionModule(boolean beanIntrospectionModule) Whether theBeanIntrospectionshould be used for reflection free object serialialization/deserialialization.voidsetDateFormat(String dateFormat) Sets the default date format to use.voidsetDefaultTyping(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping defaultTyping) Sets the global defaultTyping using for Polymorphic handling.voidsetDeserialization(Map<com.fasterxml.jackson.databind.DeserializationFeature, Boolean> deserialization) Sets the deserialization features to use.voidsetFactory(Map<com.fasterxml.jackson.core.JsonFactory.Feature, Boolean> factory) Sets the factory features to use.voidsetGenerator(Map<com.fasterxml.jackson.core.JsonGenerator.Feature, Boolean> generator) Sets the generator features to use.voidSets the locale to use.voidSets the object mapper features to use.voidsetModuleScan(boolean moduleScan) Sets whether to scan for modules or not (defaults to true).voidSets the parser features to use.voidsetPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategy propertyNamingStrategy) Sets the property naming strategy.voidsetSerialization(Map<com.fasterxml.jackson.databind.SerializationFeature, Boolean> serialization) Sets the serialization features to use.voidsetSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include serializationInclusion) Sets the serialization inclusion mode.voidsetTimeZone(TimeZone timeZone) Sets the timezone to use.voidsetTrimStrings(boolean trimStrings) Whether strings should be trimmed when deserializing (defaults to false).
- 
Field Details- 
DEFAULT_ARRAYSIZETHRESHOLDpublic static final int DEFAULT_ARRAYSIZETHRESHOLDThe default array size threshold value.- See Also:
 
- 
PROPERTY_MODULE_SCANThe property used to enable module scan.- See Also:
 
- 
PROPERTY_USE_BEAN_INTROSPECTIONThe property used to enable bean introspection.- See Also:
 
 
- 
- 
Constructor Details- 
JacksonConfigurationpublic JacksonConfiguration()
 
- 
- 
Method Details- 
isBeanIntrospectionModulepublic boolean isBeanIntrospectionModule()Whether theBeanIntrospectionshould be used for reflection free object serialialization/deserialialization.- Returns:
- True if it should
 
- 
setBeanIntrospectionModulepublic void setBeanIntrospectionModule(boolean beanIntrospectionModule) Whether theBeanIntrospectionshould be used for reflection free object serialialization/deserialialization.- Parameters:
- beanIntrospectionModule- True if it should
 
- 
isModuleScanpublic boolean isModuleScan()Whether Jackson modules should be scanned for.- Returns:
- True if module scanning is enabled
 
- 
setModuleScanpublic void setModuleScan(boolean moduleScan) Sets whether to scan for modules or not (defaults to true).- Parameters:
- moduleScan- True if module scan should be enabled
 
- 
getSerializationInclusionpublic com.fasterxml.jackson.annotation.JsonInclude.Include getSerializationInclusion()- Returns:
- The default serialization inclusion settings
 
- 
getDefaultTypingpublic com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping getDefaultTyping()- Returns:
- The global defaultTyping using for Polymorphic handling
 
- 
getLocale- Returns:
- The default locale to use
 
- 
getTimeZone- Returns:
- The default time zone to use
 
- 
getDateFormat- Returns:
- The date format to use for dates
 
- 
getSerializationSettings- Returns:
- The serialization settings
 
- 
getDeserializationSettingspublic Map<com.fasterxml.jackson.databind.DeserializationFeature,Boolean> getDeserializationSettings()- Returns:
- The deserialization settings
 
- 
getMapperSettings- Returns:
- Settings for the object mapper
 
- 
getParserSettings- Returns:
- Settings for the parser
 
- 
getGeneratorSettings- Returns:
- Settings for the generator
 
- 
getFactorySettings- Returns:
- Settings for the factory
 
- 
getArraySizeThresholdpublic int getArraySizeThreshold()- Specified by:
- getArraySizeThresholdin interface- JsonConfiguration
- Returns:
- The array size threshold to use when using Jackson for data binding
 
- 
getPropertyNamingStrategypublic com.fasterxml.jackson.databind.PropertyNamingStrategy getPropertyNamingStrategy()- Returns:
- The property naming strategy
 
- 
isAlwaysSerializeErrorsAsListpublic 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:
- isAlwaysSerializeErrorsAsListin interface- JsonConfiguration
- Returns:
- True if _embedded.errors should always be serialized as list.
 
- 
isTrimStringspublic 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.
 
- 
setDateFormatSets the default date format to use.- Parameters:
- dateFormat- The date format
 
- 
setLocaleSets the locale to use.- Parameters:
- locale- The locale
 
- 
setTimeZoneSets the timezone to use.- Parameters:
- timeZone- The timezone
 
- 
setArraySizeThresholdpublic void setArraySizeThreshold(int arraySizeThreshold) Sets the array size threshold for data binding. Default value (100).- Parameters:
- arraySizeThreshold- The array size threshold
 
- 
setSerializationpublic void setSerialization(Map<com.fasterxml.jackson.databind.SerializationFeature, Boolean> serialization) Sets the serialization features to use.- Parameters:
- serialization- The serialization features.
 
- 
setDeserializationpublic void setDeserialization(Map<com.fasterxml.jackson.databind.DeserializationFeature, Boolean> deserialization) Sets the deserialization features to use.- Parameters:
- deserialization- The deserialiation features.
 
- 
setMapperSets the object mapper features to use.- Parameters:
- mapper- The object mapper features
 
- 
setParserSets the parser features to use.- Parameters:
- parser- The parser features
 
- 
setGeneratorSets the generator features to use.- Parameters:
- generator- The generator features
 
- 
setFactorySets the factory features to use.- Parameters:
- factory- The generator features
 
- 
setSerializationInclusionpublic void setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include serializationInclusion) Sets the serialization inclusion mode.- Parameters:
- serializationInclusion- The serialization inclusion mode
 
- 
setDefaultTypingpublic void setDefaultTyping(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping defaultTyping) Sets the global defaultTyping using for Polymorphic handling.- Parameters:
- defaultTyping- The defaultTyping
 
- 
setPropertyNamingStrategypublic void setPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategy propertyNamingStrategy) Sets the property naming strategy.- Parameters:
- propertyNamingStrategy- The property naming strategy
 
- 
setAlwaysSerializeErrorsAsListpublic 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
 
- 
setTrimStringspublic 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
 
- 
constructTypepublic 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
 
 
-