Class Unmarshaller.Listener
- Enclosing interface:
- Unmarshaller
Register an instance of an implementation of this class with Unmarshaller
to externally listen
for unmarshal events.
This class enables pre and post processing of an instance of a Jakarta XML Binding mapped class as XML data is unmarshalled into it. The event callbacks are called when unmarshalling XML content into a JAXBElement instance or a Jakarta XML Binding mapped class that represents a complex type definition. The event callbacks are not called when unmarshalling to an instance of a Java datatype that represents a simple type definition.
External listener is one of two different mechanisms for defining unmarshal event callbacks. See Unmarshal Event Callbacks for an overview.
(@link #setListener(Listener)} (@link #getListener()}- Since:
- 1.6, JAXB 2.0
-
Constructor Summary
ModifierConstructorDescriptionprotected
Listener()
Do-nothing constructor for the derived classes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterUnmarshal
(Object target, Object parent) Callback method invoked after unmarshalling XML data intotarget
.void
beforeUnmarshal
(Object target, Object parent) Callback method invoked before unmarshalling intotarget
.
-
Constructor Details
-
Listener
protected Listener()Do-nothing constructor for the derived classes.
-
-
Method Details
-
beforeUnmarshal
Callback method invoked before unmarshalling into
target
.This method is invoked immediately after
target
was created and before the unmarshalling of this object begins. Note that if the class oftarget
defines its ownbeforeUnmarshal
method, the class specific callback method is invoked before this method is invoked.- Parameters:
target
- non-null instance of Jakarta XML Binding mapped class prior to unmarshalling into it.parent
- instance of Jakarta XML Binding mapped class that will eventually referencetarget
.null
whentarget
is root element.
-
afterUnmarshal
Callback method invoked after unmarshalling XML data into
target
.This method is invoked after all the properties (except IDREF) are unmarshalled into
target
, but beforetarget
is set into itsparent
object. Note that if the class oftarget
defines its ownafterUnmarshal
method, the class specific callback method is invoked before this method is invoked.- Parameters:
target
- non-null instance of Jakarta XML Binding mapped class prior to unmarshalling into it.parent
- instance of Jakarta XML Binding mapped class that will referencetarget
.null
whentarget
is root element.
-