Class AbstractJaxb2HttpMessageConverter<T>

Type Parameters:
T - the converted object type
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, Rossen Stoyanchev
  • Constructor Details

    • AbstractJaxb2HttpMessageConverter

      public AbstractJaxb2HttpMessageConverter()
  • Method Details

    • 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
    • customizeMarshaller

      protected void customizeMarshaller(Marshaller marshaller)
      Customize the Marshaller created by this message converter before using it to write the object to the output.
      Parameters:
      marshaller - the marshaller to customize
      Since:
      4.0.3
      See Also:
    • createUnmarshaller

      protected final Unmarshaller createUnmarshaller(Class<?> clazz)
      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
    • customizeUnmarshaller

      protected void customizeUnmarshaller(Unmarshaller unmarshaller)
      Customize the Unmarshaller created by this message converter before using it to read the object from the input.
      Parameters:
      unmarshaller - the unmarshaller to customize
      Since:
      4.0.3
      See Also:
    • 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