Class MappingJacksonValue
java.lang.Object
org.springframework.http.converter.json.MappingJacksonValue
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
ConstructorDescriptionMappingJacksonValue
(Object value) Create a new instance wrapping the given POJO to be serialized. -
Method Summary
Modifier and TypeMethodDescriptionReturn the Jackson filter provider to use.Class<?>
Return the serialization view to use.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
(Class<?> serializationView) Set the serialization view to serialize the POJO with.void
Modify the POJO to serialize.
-
Constructor Details
-
MappingJacksonValue
Create a new instance wrapping the given POJO to be serialized.- Parameters:
value
- the Object to be serialized
-
-
Method Details
-
setValue
Modify the POJO to serialize. -
getValue
Return the POJO that needs to be serialized. -
setSerializationView
Set the serialization view to serialize the POJO with.- See Also:
-
ObjectMapper.writerWithView(Class)
JsonView
-
getSerializationView
Return the serialization view to use.- See Also:
-
ObjectMapper.writerWithView(Class)
JsonView
-
setFilters
Set the Jackson filter provider to serialize the POJO with.- Since:
- 4.2
- See Also:
-
getFilters
Return the Jackson filter provider to use.- Since:
- 4.2
- See Also:
-
ObjectMapper.writer(FilterProvider)
JsonFilter
-