Class ObjectMapperFactoryBean

All Implemented Interfaces:
ObjectMapperService, org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>

public class ObjectMapperFactoryBean extends ObjectMapperModuleSupport implements org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
Factory for ObjectMapper that allows configuring an application-wide ObjectMapper.

This factory will generate a Module and register that with the returned ObjectMapper.

The configurable properties of this class are:

moduleName
A Module name to use.
moduleVersion
A Version to use for the module.
serializers
A list of serializers to register with the module.
deserializers
A list of deserializers to register with the module. Note that these must be subclasses of StdDeserializer.
mapper
The ObjectMapper to configure.
serializationInclusion
A serialization inclusion setting to configure.
featuresToEnable
A list of SerializationFeature or DeserializationFeature flags to enable.
featuresToDisable
A list of SerializationFeature or DeserializationFeature flags to disable.
Version:
1.5
Author:
matt
  • Constructor Details

    • ObjectMapperFactoryBean

      public ObjectMapperFactoryBean()
  • Method Details

    • getObject

      public com.fasterxml.jackson.databind.ObjectMapper getObject() throws Exception
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
      Throws:
      Exception
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<com.fasterxml.jackson.databind.ObjectMapper>
    • getSerializationInclusion

      public com.fasterxml.jackson.annotation.JsonInclude.Include getSerializationInclusion()
      Get the serialization inclusion setting.
      Returns:
      the serialization inclusion
      Since:
      1.2
    • setSerializationInclusion

      public void setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include serializationInclusion)
      Set the serialization inclusion to use.
      Parameters:
      serializationInclusion - the inclusion setting
      Since:
      1.2
    • getFeaturesToEnable

      public List<Object> getFeaturesToEnable()
      Get a list of SerializationFeature or DeserializationFeature flags to enable.
      Returns:
      list of features to enable
      Since:
      1.2
    • setFeaturesToEnable

      public void setFeaturesToEnable(List<Object> featuresToEnable)
      Set a list of SerializationFeature or DeserializationFeature flags to enable.
      Parameters:
      featuresToEnable - the list of features to enable
      Since:
      1.2
    • getFeaturesToDisable

      public List<Object> getFeaturesToDisable()
      Get a list of SerializationFeature or DeserializationFeature flags to disable.
      Returns:
      the list of features to disable
      Since:
      1.2
    • setFeaturesToDisable

      public void setFeaturesToDisable(List<Object> featuresToDisable)
      Set a list of SerializationFeature or DeserializationFeature flags to disable.
      Parameters:
      featuresToDisable - the list of features to disable
      Since:
      1.2