Class Marshaller.Listener
- Enclosing interface:
- Marshaller
Register an instance of an implementation of this class with a Marshaller
to 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.
- Since:
- 1.6, JAXB 2.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterMarshal
(Object source) Callback method invoked after marshallingsource
to XML.void
beforeMarshal
(Object source) Callback method invoked before marshalling fromsource
to XML.
-
Constructor Details
-
Listener
public Listener()
-
-
Method Details
-
beforeMarshal
Callback method invoked before marshalling from
source
to XML.This method is invoked just before marshalling process starts to marshal
source
. Note that if the class ofsource
defines its ownbeforeMarshal
method, the class specific callback method is invoked just before this method is invoked.- Parameters:
source
- instance of Jakarta XML Binding mapped class prior to marshalling from it.
-
afterMarshal
Callback method invoked after marshalling
source
to XML.This method is invoked after
source
and all its descendants have been marshalled. Note that if the class ofsource
defines its ownafterMarshal
method, the class specific callback method is invoked just before this method is invoked.- Parameters:
source
- instance of Jakarta XML Binding mapped class after marshalling it.
-