public class Jaxb2XmlDecoder extends AbstractDecoder<java.lang.Object>
Object
s (POJOs).Jaxb2XmlEncoder
Modifier and Type | Class and Description |
---|---|
private static class |
Jaxb2XmlDecoder.SplitFunction |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
JAXB_DEFAULT_ANNOTATION_VALUE
The default value for JAXB annotations.
|
private JaxbContextContainer |
jaxbContexts |
private XmlEventDecoder |
xmlEventDecoder |
Constructor and Description |
---|
Jaxb2XmlDecoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecode(ResolvableType elementType,
MimeType mimeType)
Whether the decoder supports the given target element type and the MIME
type of the source stream.
|
<any> |
decode(<any> inputStream,
ResolvableType elementType,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Decode a
DataBuffer input stream into a Flux of T . |
(package private) <any> |
split(<any> xmlEventFlux,
javax.xml.namespace.QName desiredName)
Split a flux of
XMLEvent s into a flux of XMLEvent lists, one list
for each branch of the tree that starts with the given qualified name. |
(package private) javax.xml.namespace.QName |
toQName(java.lang.Class<?> outputClass)
Returns the qualified name for the given class, according to the mapping rules
in the JAXB specification.
|
private java.lang.Object |
unmarshal(java.util.List<javax.xml.stream.events.XMLEvent> events,
java.lang.Class<?> outputClass) |
decodeToMono, getDecodableMimeTypes
private static final java.lang.String JAXB_DEFAULT_ANNOTATION_VALUE
XmlRootElement.name()
,
XmlRootElement.namespace()
,
XmlType.name()
,
XmlType.namespace()
,
Constant Field Valuesprivate final XmlEventDecoder xmlEventDecoder
private final JaxbContextContainer jaxbContexts
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
Decoder
canDecode
in interface Decoder<java.lang.Object>
canDecode
in class AbstractDecoder<java.lang.Object>
elementType
- the target element type for the output streammimeType
- the mime type associated with the stream to decode
(can be null
if not specified)true
if supported, false
otherwisepublic <any> decode(<any> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
Decoder
DataBuffer
input stream into a Flux of T
.inputStream
- the DataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encodeprivate java.lang.Object unmarshal(java.util.List<javax.xml.stream.events.XMLEvent> events, java.lang.Class<?> outputClass)
javax.xml.namespace.QName toQName(java.lang.Class<?> outputClass)
<any> split(<any> xmlEventFlux, javax.xml.namespace.QName desiredName)
XMLEvent
s into a flux of XMLEvent lists, one list
for each branch of the tree that starts with the given qualified name.
That is, given the XMLEvents shown here,
and the desiredName
"child
", this method returns a flux
of two lists, each of which containing the events of a particular branch
of the tree that starts with "child
".
StartElement
child
Characters
foo
EndElement
child
StartElement
child
Characters
bar
EndElement
child