org.springframework.http.converter.json

Class MappingJacksonValue

  • java.lang.Object
    • org.springframework.http.converter.json.MappingJacksonValue


  • public class MappingJacksonValue
    extends java.lang.Object
    A simple holder for the POJO to serialize via MappingJackson2HttpMessageConverter along with further serialization instructions to be passed in to the converter.

    On the server side this wrapper is added with a ResponseBodyInterceptor after content negotiation selects the converter to use but before the write.

    On the client side, simply wrap the POJO and pass it in to the RestTemplate.

    Since:
    4.1
    Author:
    Rossen Stoyanchev
    • Constructor Summary

      Constructors 
      Constructor and Description
      MappingJacksonValue(java.lang.Object value)
      Create a new instance wrapping the given POJO to be serialized.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      FilterProvider getFilters()
      Return the Jackson filter provider to use.
      java.lang.Class<?> getSerializationView()
      Return the serialization view to use.
      java.lang.Object getValue()
      Return the POJO that needs to be serialized.
      void setFilters(FilterProvider filters)
      Set the Jackson filter provider to serialize the POJO with.
      void setSerializationView(java.lang.Class<?> serializationView)
      Set the serialization view to serialize the POJO with.
      void setValue(java.lang.Object value)
      Modify the POJO to serialize.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait