public class MappingJacksonValue extends Object
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
.
Constructor and Description |
---|
MappingJacksonValue(Object value)
Create a new instance wrapping the given POJO to be serialized.
|
Modifier and Type | Method and Description |
---|---|
FilterProvider |
getFilters()
Return the Jackson filter provider to use.
|
String |
getJsonpFunction()
Return the configured JSONP function name.
|
Class<?> |
getSerializationView()
Return the serialization view to use.
|
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 |
setJsonpFunction(String functionName)
Set the name of the JSONP function name.
|
void |
setSerializationView(Class<?> serializationView)
Set the serialization view to serialize the POJO with.
|
void |
setValue(Object value)
Modify the POJO to serialize.
|
public MappingJacksonValue(Object value)
value
- the Object to be serializedpublic void setValue(Object value)
public Object getValue()
public void setSerializationView(@Nullable Class<?> serializationView)
ObjectMapper.writerWithView(Class)
,
JsonView
@Nullable public Class<?> getSerializationView()
ObjectMapper.writerWithView(Class)
,
JsonView
public void setFilters(@Nullable FilterProvider filters)
ObjectMapper.writer(FilterProvider)
,
JsonFilter
,
Jackson2ObjectMapperBuilder.filters(FilterProvider)
@Nullable public FilterProvider getFilters()
ObjectMapper.writer(FilterProvider)
,
JsonFilter
public void setJsonpFunction(@Nullable String functionName)