public class Jaxb2XmlEncoder extends AbstractSingleValueEncoder<java.lang.Object>
@XmlElements
and
@XmlElement
can be used
to specify how collections should be marshalled.
Jaxb2XmlDecoder
Modifier and Type | Field and Description |
---|---|
private JaxbContextContainer |
jaxbContexts |
private java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> |
marshallerProcessor |
logger
Constructor and Description |
---|
Jaxb2XmlEncoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
canEncode(ResolvableType elementType,
MimeType mimeType)
Whether the encoder supports the given source element type and the MIME
type for the output stream.
|
protected <any> |
encode(java.lang.Object value,
DataBufferFactory bufferFactory,
ResolvableType type,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Encode
T to an output DataBuffer stream. |
java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> |
getMarshallerProcessor()
Return the configured processor for customizing Marshaller instances.
|
private javax.xml.bind.Marshaller |
initMarshaller(java.lang.Class<?> clazz) |
void |
setMarshallerProcessor(java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> processor)
Configure a processor function to customize Marshaller instances.
|
getEncodableMimeTypes, getLogger, setLogger
private final JaxbContextContainer jaxbContexts
private java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> marshallerProcessor
public void setMarshallerProcessor(java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> processor)
processor
- the function to usepublic java.util.function.Function<javax.xml.bind.Marshaller,javax.xml.bind.Marshaller> getMarshallerProcessor()
public boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType)
Encoder
canEncode
in interface Encoder<java.lang.Object>
canEncode
in class AbstractEncoder<java.lang.Object>
elementType
- the type of elements in the source streammimeType
- the MIME type for the output stream
(can be null
if not specified)true
if supported, false
otherwiseprotected <any> encode(java.lang.Object value, DataBufferFactory bufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
AbstractSingleValueEncoder
T
to an output DataBuffer
stream.encode
in interface Encoder<java.lang.Object>
encode
in class AbstractSingleValueEncoder<java.lang.Object>
value
- the value to processbufferFactory
- a buffer factory used to create the outputtype
- the stream element type to processmimeType
- the mime type to processhints
- additional information about how to do decode, optionalprivate javax.xml.bind.Marshaller initMarshaller(java.lang.Class<?> clazz) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException