org.springframework.http.converter.xml

## Class AbstractJaxb2HttpMessageConverter<T>

- java.lang.Object
- - org.springframework.http.converter.AbstractHttpMessageConverter<T>
  - - org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
    - - org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter<T>

All Implemented Interfaces:
  HttpMessageConverter<T>

Direct Known Subclasses:
  Jaxb2CollectionHttpMessageConverter, Jaxb2RootElementHttpMessageConverter

    public abstract class AbstractJaxb2HttpMessageConverter<T>
    extends AbstractXmlHttpMessageConverter<T>

Abstract base class for `HttpMessageConverters` that use JAXB2. Creates `JAXBContext` object lazily.

Since:
  3.0
Author:
  Arjen Poutsma

### Field Summary

### Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

`logger`

### Constructor Summary

Constructors
Constructor and Description
`AbstractJaxb2HttpMessageConverter()`

### Method Summary

Methods
`protected Marshaller` `createMarshaller(Class clazz)` Create a new `Marshaller` for the given class.
`protected Unmarshaller` `createUnmarshaller(Class clazz)` Create a new `Unmarshaller` for the given class.
`protected JAXBContext` `getJaxbContext(Class clazz)` Return a `JAXBContext` for the given class.

### Methods inherited from class org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter

`readFromSource, readInternal, transform, writeInternal, writeToResult`

### Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

`canRead, canRead, canWrite, canWrite, getContentLength, getDefaultContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, supports, write`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractJaxb2HttpMessageConverter

    public AbstractJaxb2HttpMessageConverter()

### Method Detail

#### createMarshaller

    protected final Marshaller createMarshaller(Class clazz)

Create a new `Marshaller` for the given class.

Parameters:
  `clazz` - the class to create the marshaller for
Returns:
  the `Marshaller`
Throws:
  `HttpMessageConversionException` - in case of JAXB errors

#### createUnmarshaller

    protected final Unmarshaller createUnmarshaller(Class clazz)
                                             throws JAXBException

Create a new `Unmarshaller` for the given class.

Parameters:
  `clazz` - the class to create the unmarshaller for
Returns:
  the `Unmarshaller`
Throws:
  `HttpMessageConversionException` - in case of JAXB errors
  `JAXBException`

#### getJaxbContext

    protected final JAXBContext getJaxbContext(Class clazz)

Return a `JAXBContext` for the given class.

Parameters:
  `clazz` - the class to return the context for
Returns:
  the `JAXBContext`
Throws:
  `HttpMessageConversionException` - in case of JAXB errors