接口 Marshaller
- 所有已知子接口:
GenericMarshaller,MimeMarshaller
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.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
- 另请参阅:
Unmarshaller
方法详细资料
supports
boolean supports(Class<?> clazz)
Indicate whether this marshaller can marshal instances of the supplied type.- 参数:
clazz- the class that this marshaller is being asked if it can marshal- 返回:
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.- 参数:
graph- the root of the object graph to marshalresult- the result to marshal to- 抛出:
IOException- if an I/O error occursXmlMappingException- if the given object cannot be marshalled to the result