类 JsonbHttpMessageConverter
- java.lang.Object
- org.springframework.http.converter.AbstractHttpMessageConverter<T>
- org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
- org.springframework.http.converter.json.AbstractJsonHttpMessageConverter
- org.springframework.http.converter.json.JsonbHttpMessageConverter
- 所有已实现的接口:
GenericHttpMessageConverter<Object>
,HttpMessageConverter<Object>
public class JsonbHttpMessageConverter extends AbstractJsonHttpMessageConverter
Implementation ofHttpMessageConverter
that can read and write JSON using the JSON Binding API.This converter can be used to bind to typed beans or untyped
HashMap
s. By default, it supportsapplication/json
andapplication/*+json
withUTF-8
character set.- 从以下版本开始:
- 5.0
- 作者:
- Juergen Hoeller
- 另请参阅:
Jsonb
,JsonbBuilder
,setJsonb(javax.json.bind.Jsonb)
字段概要
从类继承的字段 org.springframework.http.converter.json.AbstractJsonHttpMessageConverter
DEFAULT_CHARSET
从类继承的字段 org.springframework.http.converter.AbstractHttpMessageConverter
logger
构造器概要
构造器 构造器 说明 JsonbHttpMessageConverter()
Construct a newJsonbHttpMessageConverter
with default configuration.JsonbHttpMessageConverter(javax.json.bind.Jsonb jsonb)
Construct a newJsonbHttpMessageConverter
with the given delegate.JsonbHttpMessageConverter(javax.json.bind.JsonbConfig config)
Construct a newJsonbHttpMessageConverter
with the given configuration.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 javax.json.bind.Jsonb
getJsonb()
Return the configuredJsonb
instance for this converter.protected Object
readInternal(Type resolvedType, Reader reader)
Template method that reads the JSON-bound object from the givenReader
.void
setJsonb(javax.json.bind.Jsonb jsonb)
Set theJsonb
instance to use.protected void
writeInternal(Object object, Type type, Writer writer)
Template method that writes the JSON-bound object to the givenWriter
.从类继承的方法 org.springframework.http.converter.json.AbstractJsonHttpMessageConverter
read, readInternal, setJsonPrefix, setPrefixJson, writeInternal
从类继承的方法 org.springframework.http.converter.AbstractGenericHttpMessageConverter
canRead, canWrite, supports, write, writeInternal
从类继承的方法 org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.http.converter.HttpMessageConverter
canRead, canWrite, getSupportedMediaTypes, read, write
构造器详细资料
JsonbHttpMessageConverter
public JsonbHttpMessageConverter()
Construct a newJsonbHttpMessageConverter
with default configuration.
JsonbHttpMessageConverter
public JsonbHttpMessageConverter(javax.json.bind.JsonbConfig config)
Construct a newJsonbHttpMessageConverter
with the given configuration.- 参数:
config
- theJsonbConfig
for the underlying delegate
JsonbHttpMessageConverter
public JsonbHttpMessageConverter(javax.json.bind.Jsonb jsonb)
Construct a newJsonbHttpMessageConverter
with the given delegate.- 参数:
jsonb
- the Jsonb instance to use
方法详细资料
setJsonb
public void setJsonb(javax.json.bind.Jsonb jsonb)
Set theJsonb
instance to use. If not set, a defaultJsonb
instance will be created.Setting a custom-configured
Jsonb
is one way to take further control of the JSON serialization process.- 另请参阅:
JsonbHttpMessageConverter(Jsonb)
,JsonbHttpMessageConverter(JsonbConfig)
,JsonbBuilder
getJsonb
public javax.json.bind.Jsonb getJsonb()
Return the configuredJsonb
instance for this converter.
readInternal
protected Object readInternal(Type resolvedType, Reader reader) throws Exception
从类复制的说明:AbstractJsonHttpMessageConverter
Template method that reads the JSON-bound object from the givenReader
.- 指定者:
readInternal
在类中AbstractJsonHttpMessageConverter
- 参数:
resolvedType
- the resolved generic typereader
- the Reader to use- 返回:
- the JSON-bound object
- 抛出:
Exception
- in case of read/parse failures
writeInternal
protected void writeInternal(Object object, @Nullable Type type, Writer writer) throws Exception
从类复制的说明:AbstractJsonHttpMessageConverter
Template method that writes the JSON-bound object to the givenWriter
.- 指定者:
writeInternal
在类中AbstractJsonHttpMessageConverter
- 参数:
object
- the object to write to the output messagetype
- the type of object to write (may benull
)writer
- the Writer to use- 抛出:
Exception
- in case of write failures