HttpMessageConverter that can read XML collections using JAXB2.
This converter can read collections that contain classes
annotated with XmlRootElement and XmlType. Note that this converter
does not support writing.
| Modifier and Type | Field and Description |
|---|---|
| private final XMLInputFactory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRead(Class<?>
the class to test for readability clazz, MediaType the media type to read (can be mediaType)null if not specified);
typically the value of a Content-Type header.Overrides org. Implements org. Always returns |
| public boolean | canRead(Type
the (potentially generic) type to test for readability type, Class<?> a context class for the target type, for example a class
in which the target type appears in a method signature (can be contextClass, MediaType null)the media type to read, can be mediaType)null if not specified.
Typically, the value of a Content-Type header.Implements org. Indicates whether the given type can be read by this converter. |
| public boolean | canWrite(Class<?>
the class to test for writability clazz, MediaType the media type to write (can be mediaType)null if not specified);
typically the value of an Accept header.Overrides org. Implements org. Always returns |
| public boolean | canWrite(Type
the (potentially generic) type to test for writability
(can be type, Class<?> null if not specified)the source object class to test for writability clazz, MediaType the media type to write (can be mediaType)null if not specified);
typically the value of an Accept header.Implements org. Always returns |
| protected T | Returns: the created Collection instancethe type of Collection to instantiate collectionClass)Create a Collection of the given type, with the given initial capacity (if supported by the Collection type). |
| protected XMLInputFactory | createXmlInputFactory()
Create an |
| private int | |
| private int | |
| public T | read(Type
the (potentially generic) type of object to return. This type must have
previously been passed to the type, Class<?> canRead method of this interface,
which must have returned true.a context class for the target type, for example a class
in which the target type appears in a method signature (can be contextClass, HttpInputMessage null)the HTTP input message to read from inputMessage)Implements org. Read an object of the given type form the given input message, and returns it. |
| protected T | readFromSource(Class<? extends T>
the type of object to return clazz, HttpHeaders the HTTP input headers headers, Source the HTTP input body source)Implements abstract org. Abstract template method called from |
| protected boolean | supports(Class<?>
the class to test for support clazz)Implements abstract org. Indicates whether the given class is supported by this converter. |
| public void | write(T
the object to write to the output message. The type of this object must
have previously been passed to the t, Type canWrite method of this
interface, which must have returned true.the (potentially generic) type of object to write. This type must have
previously been passed to the type, MediaType canWrite method of this interface,
which must have returned true. Can be null if not specified.the content type to use when writing. May be contentType, HttpOutputMessage null to
indicate that the default content type of the converter must be used. If not
null, this media type must have previously been passed to the
canWrite method of this interface, which must have returned
true.the message to write to outputMessage)Implements org. Write a given object to the given output message. |
| protected void | writeToResult(T
the object to write to the output message t, HttpHeaders the HTTP output headers headers, Result the HTTP output body result)Implements abstract org. Abstract template method called from |
| inputFactory | back to summary |
|---|---|
| private final XMLInputFactory inputFactory | |
| Jaxb2CollectionHttpMessageConverter | back to summary |
|---|---|
| public Jaxb2CollectionHttpMessageConverter() | |
| canRead | back to summary |
|---|---|
| public boolean canRead(Class<?> clazz, MediaType mediaType) Overrides org. Implements org. Always returns
| |
| canRead | back to summary |
|---|---|
| public boolean canRead(Type type, Class<?> contextClass, MediaType mediaType) Implements org. Doc from org. Indicates whether the given type can be read by this converter.
This method should perform the same checks as
Jaxb2CollectionHttpMessageConverter can read a generic
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(Class<?> clazz, MediaType mediaType) Overrides org. Implements org. Always returns
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) Implements org. Always returns
| |
| createCollection | back to summary |
|---|---|
| protected T createCollection(Class<?> collectionClass) Create a Collection of the given type, with the given initial capacity (if supported by the Collection type).
| |
| createXmlInputFactory | back to summary |
|---|---|
| protected XMLInputFactory createXmlInputFactory() Create an Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so this method will only be called once. | |
| moveToFirstChildOfRootElement | back to summary |
|---|---|
| private int moveToFirstChildOfRootElement(XMLStreamReader streamReader) throws XMLStreamException | |
| moveToNextElement | back to summary |
|---|---|
| private int moveToNextElement(XMLStreamReader streamReader) throws XMLStreamException | |
| read | back to summary |
|---|---|
| public T read(Type type, Class<?> contextClass, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException Implements org. Doc from org. Read an object of the given type form the given input message, and returns it.
| |
| readFromSource | back to summary |
|---|---|
| protected T readFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source) throws Exception Implements abstract org. Doc from org. Abstract template method called from
| |
| supports | back to summary |
|---|---|
| protected boolean supports(Class<?> clazz) Implements abstract org. Doc from org. Indicates whether the given class is supported by this converter. | |
| write | back to summary |
|---|---|
| public void write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException Implements org. Doc from org. Write a given object to the given output message.
| |
| writeToResult | back to summary |
|---|---|
| protected void writeToResult(T t, HttpHeaders headers, Result result) throws Exception Implements abstract org. Doc from org. Abstract template method called from
| |