public class MappingJacksonValue
extends java.lang.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
.
Modifier and Type | Field and Description |
---|---|
private FilterProvider |
filters |
private java.lang.String |
jsonpFunction |
private java.lang.Class<?> |
serializationView |
private java.lang.Object |
value |
Constructor and Description |
---|
MappingJacksonValue(java.lang.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.
|
java.lang.String |
getJsonpFunction()
Return the configured JSONP function name.
|
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 |
setJsonpFunction(java.lang.String functionName)
Set the name of the JSONP function name.
|
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.
|
private java.lang.Object value
@Nullable private java.lang.Class<?> serializationView
@Nullable private FilterProvider filters
@Nullable private java.lang.String jsonpFunction
public MappingJacksonValue(java.lang.Object value)
value
- the Object to be serializedpublic void setValue(java.lang.Object value)
public java.lang.Object getValue()
public void setSerializationView(@Nullable java.lang.Class<?> serializationView)
com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
,
com.fasterxml.jackson.annotation.JsonView
@Nullable public java.lang.Class<?> getSerializationView()
com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
,
com.fasterxml.jackson.annotation.JsonView
public void setFilters(@Nullable FilterProvider filters)
com.fasterxml.jackson.databind.ObjectMapper#writer(FilterProvider)
,
com.fasterxml.jackson.annotation.JsonFilter
,
Jackson2ObjectMapperBuilder.filters(FilterProvider)
@Nullable public FilterProvider getFilters()
com.fasterxml.jackson.databind.ObjectMapper#writer(FilterProvider)
,
com.fasterxml.jackson.annotation.JsonFilter
public void setJsonpFunction(@Nullable java.lang.String functionName)
@Nullable public java.lang.String getJsonpFunction()