类 MappingJacksonValue
- java.lang.Object
- org.springframework.http.converter.json.MappingJacksonValue
public class MappingJacksonValue extends Object
A simple holder for the POJO to serialize viaMappingJackson2HttpMessageConverter
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
.- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 MappingJacksonValue(Object value)
Create a new instance wrapping the given POJO to be serialized.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 FilterProvider
getFilters()
Return the Jackson filter provider to use.String
getJsonpFunction()
已过时。Will be removed as of Spring Framework 5.1, use CORS instead.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)
已过时。Will be removed as of Spring Framework 5.1, use CORS instead.void
setSerializationView(Class<?> serializationView)
Set the serialization view to serialize the POJO with.void
setValue(Object value)
Modify the POJO to serialize.
构造器详细资料
MappingJacksonValue
public MappingJacksonValue(Object value)
Create a new instance wrapping the given POJO to be serialized.- 参数:
value
- the Object to be serialized
方法详细资料
setSerializationView
public void setSerializationView(Class<?> serializationView)
Set the serialization view to serialize the POJO with.- 另请参阅:
ObjectMapper.writerWithView(Class)
,JsonView
getSerializationView
public Class<?> getSerializationView()
Return the serialization view to use.- 另请参阅:
ObjectMapper.writerWithView(Class)
,JsonView
setFilters
public void setFilters(FilterProvider filters)
Set the Jackson filter provider to serialize the POJO with.- 从以下版本开始:
- 4.2
- 另请参阅:
ObjectMapper.writer(FilterProvider)
,JsonFilter
,Jackson2ObjectMapperBuilder.filters(FilterProvider)
getFilters
public FilterProvider getFilters()
Return the Jackson filter provider to use.- 从以下版本开始:
- 4.2
- 另请参阅:
ObjectMapper.writer(FilterProvider)
,JsonFilter
setJsonpFunction
@Deprecated public void setJsonpFunction(String functionName)
已过时。Will be removed as of Spring Framework 5.1, use CORS instead.Set the name of the JSONP function name.
getJsonpFunction
@Deprecated public String getJsonpFunction()
已过时。Will be removed as of Spring Framework 5.1, use CORS instead.Return the configured JSONP function name.