Class Marshaller.Listener
- java.lang.Object
-
- javax.xml.bind.Marshaller.Listener
-
- Enclosing interface:
- Marshaller
public abstract static class Marshaller.Listener extends java.lang.ObjectRegister an instance of an implementation of this class with a
Marshallerto externally listen for marshal events.This class enables pre and post processing of each marshalled object. The event callbacks are called when marshalling from an instance that maps to an xml element or complex type definition. The event callbacks are not called when marshalling from an instance of a Java datatype that represents a simple type definition.
External listener is one of two different mechanisms for defining marshal event callbacks. See Marshal Event Callbacks for an overview.
- See Also:
Marshaller.setListener(Listener),Marshaller.getListener()- Since:
- 1.6, JAXB 2.0
-
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterMarshal(java.lang.Object source)Callback method invoked after marshallingsourceto XML.voidbeforeMarshal(java.lang.Object source)Callback method invoked before marshalling fromsourceto XML.
-
-
-
Method Detail
-
beforeMarshal
public void beforeMarshal(java.lang.Object source)
Callback method invoked before marshalling from
sourceto XML.This method is invoked just before marshalling process starts to marshal
source. Note that if the class ofsourcedefines its ownbeforeMarshalmethod, the class specific callback method is invoked just before this method is invoked.- Parameters:
source- instance of JAXB mapped class prior to marshalling from it.
-
afterMarshal
public void afterMarshal(java.lang.Object source)
Callback method invoked after marshalling
sourceto XML.This method is invoked after
sourceand all its descendants have been marshalled. Note that if the class ofsourcedefines its ownafterMarshalmethod, the class specific callback method is invoked just before this method is invoked.- Parameters:
source- instance of JAXB mapped class after marshalling it.
-
-