spring-framework / org.springframework.http.converter.xml / Jaxb2CollectionHttpMessageConverter

Jaxb2CollectionHttpMessageConverter

open class Jaxb2CollectionHttpMessageConverter<T : MutableCollection<Any?>> : AbstractJaxb2HttpMessageConverter<T>, GenericHttpMessageConverter<T>

An HttpMessageConverter that can read XML collections using JAXB2.

This converter can read Collection that contain classes annotated with XmlRootElement and XmlType. Note that this converter does not support writing.

Author
Arjen Poutsma

Author
Rossen Stoyanchev

Since
3.2

Constructors

<init>

Jaxb2CollectionHttpMessageConverter()

An HttpMessageConverter that can read XML collections using JAXB2.

This converter can read Collection that contain classes annotated with XmlRootElement and XmlType. Note that this converter does not support writing.

Functions

canRead

open fun canRead(clazz: Class<*>, mediaType: MediaType): Boolean

Always returns false since Jaxb2CollectionHttpMessageConverter required generic type information in order to read a Collection.

open fun canRead(type: Type, contextClass: Class<*>, mediaType: MediaType): Boolean

{@inheritDoc}

Jaxb2CollectionHttpMessageConverter can read a generic Collection where the generic type is a JAXB type annotated with XmlRootElement or XmlType.

canWrite

open fun canWrite(clazz: Class<*>, mediaType: MediaType): Boolean
open fun canWrite(type: Type, clazz: Class<*>, mediaType: MediaType): Boolean

Always returns false since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.

read

open fun read(type: Type, contextClass: Class<*>, inputMessage: HttpInputMessage): T

write

open fun write(t: T, type: Type, contentType: MediaType, outputMessage: HttpOutputMessage): Unit