Interface Marshaller

All Known subinterfaces:
GenericMarshaller, MimeMarshaller
All Known Implementing Classes:
AbstractMarshaller, Jaxb2Marshaller, XstreamMarshaller

public interface Marshaller
Defines the contract for Object XML Mapping Marshallers. Implementations of this interface can serialize a given Object to an XML stream.

Although the marshal method accepts a java.lang.Object as its first parameter, most Marshaller implementations cannot handle arbitrary Objects. Instead, an object class must be registered with the marshaller, or have a common base class.

since:
3.0
Author:
Arjen Poutsma
see Also:
  • Method summary

    Modifier and Type
    Method
    Description
    void
    marshal(Object graph, Result result)
    Marshal the object graph with the given root into the provided Result.
    boolean
    supports(Class<?>&nbsp;clazz)
    Indicate whether this marshaller can marshal instances of the supplied type.
  • Method Details

    • supports

      boolean&nbsp;supports(Class<?>&nbsp;clazz)
      Indicate whether this marshaller can marshal instances of the supplied type.
      Parameters:
      clazz - the class that this marshaller is being asked if it can marshal
      Returns:
      true if this marshaller can indeed marshal instances of the supplied class; false otherwise
    • marshal

      void&nbsp;marshal(Object&nbsp;graph, Result&nbsp;result) throws IOException, XmlMappingException
      Marshal the object graph with the given root into the provided Result.
      Parameters:
      graph - the root of the object graph to marshal
      result - the result to marshal to
      Throws:
      IOException - if an I/O error occurs
      XmlMappingException - if the given object cannot be marshalled to the result