Package org.springframework.oxm
Interface Marshaller
- All Known Subinterfaces:
GenericMarshaller,MimeMarshaller
- All Known Implementing Classes:
AbstractMarshaller,CastorMarshaller,Jaxb2Marshaller,JibxMarshaller,XmlBeansMarshaller,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
marshalmethod accepts ajava.lang.Objectas its first parameter, mostMarshallerimplementations cannot handle arbitraryObjects. Instead, a object class must be registered with the marshaller, or have a common base class.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
Unmarshaller
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidmarshal(Object graph, Result result)Marshal the object graph with the given root into the providedResult.booleansupports(Class<?> clazz)Indicate whether this marshaller can marshal instances of the supplied type.
Method Detail
supports
boolean supports(Class<?> 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:
trueif this marshaller can indeed marshal instances of the supplied class;falseotherwise
marshal
void marshal(Object graph, Result result) throws IOException, XmlMappingException
Marshal the object graph with the given root into the providedResult.- Parameters:
graph- the root of the object graph to marshalresult- the result to marshal to- Throws:
IOException- if an I/O error occursXmlMappingException- if the given object cannot be marshalled to the result