类 Jaxb2XmlEncoder
- java.lang.Object
- org.springframework.core.codec.AbstractEncoder<T>
- org.springframework.core.codec.AbstractSingleValueEncoder<Object>
- org.springframework.http.codec.xml.Jaxb2XmlEncoder
public class Jaxb2XmlEncoder extends AbstractSingleValueEncoder<Object>
Encode from single value to a byte stream containing XML elements.@XmlElements
and@XmlElement
can be used to specify how collections should be marshalled.- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze, Arjen Poutsma
- 另请参阅:
Jaxb2XmlDecoder
字段概要
从类继承的字段 org.springframework.core.codec.AbstractEncoder
logger
构造器概要
构造器 构造器 说明 Jaxb2XmlEncoder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
canEncode(ResolvableType elementType, MimeType mimeType)
Whether the encoder supports the given source element type and the MIME type for the output stream.protected reactor.core.publisher.Flux<DataBuffer>
encode(Object value, DataBufferFactory bufferFactory, ResolvableType valueType, MimeType mimeType, Map<String,Object> hints)
EncodeT
to an outputDataBuffer
stream.DataBuffer
encodeValue(Object value, DataBufferFactory bufferFactory, ResolvableType valueType, MimeType mimeType, Map<String,Object> hints)
Encode an Object of type T to a data buffer.Function<Marshaller,Marshaller>
getMarshallerProcessor()
Return the configured processor for customizing Marshaller instances.void
setMarshallerProcessor(Function<Marshaller,Marshaller> processor)
Configure a processor function to customize Marshaller instances.从类继承的方法 org.springframework.core.codec.AbstractSingleValueEncoder
encode
从类继承的方法 org.springframework.core.codec.AbstractEncoder
getEncodableMimeTypes, getLogger, setLogger
构造器详细资料
Jaxb2XmlEncoder
public Jaxb2XmlEncoder()
方法详细资料
setMarshallerProcessor
public void setMarshallerProcessor(Function<Marshaller,Marshaller> processor)
Configure a processor function to customize Marshaller instances.- 参数:
processor
- the function to use- 从以下版本开始:
- 5.1.3
getMarshallerProcessor
public Function<Marshaller,Marshaller> getMarshallerProcessor()
Return the configured processor for customizing Marshaller instances.- 从以下版本开始:
- 5.1.3
canEncode
public boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType)
从接口复制的说明:Encoder
Whether the encoder supports the given source element type and the MIME type for the output stream.
encode
protected reactor.core.publisher.Flux<DataBuffer> encode(Object value, DataBufferFactory bufferFactory, ResolvableType valueType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从类复制的说明:AbstractSingleValueEncoder
EncodeT
to an outputDataBuffer
stream.- 指定者:
encode
在类中AbstractSingleValueEncoder<Object>
- 参数:
value
- the value to processbufferFactory
- a buffer factory used to create the outputvalueType
- the stream element type to processmimeType
- the mime type to processhints
- additional information about how to do decode, optional- 返回:
- the output stream
encodeValue
public DataBuffer encodeValue(Object value, DataBufferFactory bufferFactory, ResolvableType valueType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从接口复制的说明:Encoder
Encode an Object of type T to a data buffer. This is useful for scenarios, that distinct messages (or events) are encoded and handled individually, in fully aggregated form.By default this method raises
UnsupportedOperationException
and it is expected that some encoders cannot produce a single buffer or cannot do so synchronously (e.g. encoding aResource
).- 参数:
value
- the value to be encodedbufferFactory
- for creating the outputDataBuffer
valueType
- the type for the value being encodedmimeType
- the MIME type for the output content (optional)hints
- additional information about how to encode- 返回:
- the encoded content