Class Jackson2JsonObjectMapper

java.lang.Object
org.springframework.integration.support.json.AbstractJacksonJsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.databind.JavaType>
org.springframework.integration.support.json.Jackson2JsonObjectMapper
All Implemented Interfaces:
Aware, BeanClassLoaderAware, JsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser>

public class Jackson2JsonObjectMapper extends AbstractJacksonJsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.databind.JavaType>
Jackson 2 JSON-processor (@link https://github.com/FasterXML) JsonObjectMapper implementation. Delegates toJson(java.lang.Object) and fromJson(java.lang.Object, com.fasterxml.jackson.databind.JavaType) to the ObjectMapper

It customizes Jackson's default properties with the following ones:

  • MapperFeature.DEFAULT_VIEW_INCLUSION is disabled
  • DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES is disabled
  • The well-known modules are registered through the classpath scan
See org.springframework.http.converter.json.Jackson2ObjectMapperBuilder in the spring-web for more information.
Since:
3.0
Author:
Artem Bilan, Vikas Prasad
  • Constructor Details

    • Jackson2JsonObjectMapper

      public Jackson2JsonObjectMapper()
    • Jackson2JsonObjectMapper

      public Jackson2JsonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • toJson

      public String toJson(Object value) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • toJson

      public void toJson(Object value, Writer writer) throws IOException
      Throws:
      IOException
    • toJsonNode

      public com.fasterxml.jackson.databind.JsonNode toJsonNode(Object json) throws IOException
      Throws:
      IOException
    • fromJson

      protected <T> T fromJson(Object json, com.fasterxml.jackson.databind.JavaType type) throws IOException
      Specified by:
      fromJson in class AbstractJacksonJsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.databind.JavaType>
      Throws:
      IOException
    • fromJson

      public <T> T fromJson(com.fasterxml.jackson.core.JsonParser parser, Type valueType) throws IOException
      Throws:
      IOException
    • extractJavaType

      protected com.fasterxml.jackson.databind.JavaType extractJavaType(Map<String,Object> javaTypes)
      Specified by:
      extractJavaType in class AbstractJacksonJsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.databind.JavaType>
    • constructType

      protected com.fasterxml.jackson.databind.JavaType constructType(Type type)
      Specified by:
      constructType in class AbstractJacksonJsonObjectMapper<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.databind.JavaType>