Java™ Platform
Standard Ed. 6

javax.xml.bind
Class Marshaller.Listener

java.lang.Object
  extended by javax.xml.bind.Marshaller.Listener
Enclosing interface:
Marshaller

public abstract static class Marshaller.Listener
extends Object

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:
JAXB2.0
See Also:
Marshaller.setListener(Listener), Marshaller.getListener()

Constructor Summary
Marshaller.Listener()
           
 
Method Summary
 void afterMarshal(Object source)
          

Callback method invoked after marshalling source to XML.

 void beforeMarshal(Object source)
          

Callback method invoked before marshalling from source to XML.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Marshaller.Listener

public Marshaller.Listener()
Method Detail

beforeMarshal

public void beforeMarshal(Object source)

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 of source defines its own beforeMarshal method, 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(Object source)

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 of source defines its own afterMarshal method, the class specific callback method is invoked just before this method is invoked.

Parameters:
source - instance of JAXB mapped class after marshalling it.

Java™ Platform
Standard Ed. 6

Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.

Scripting on this page tracks web page traffic, but does not change the content in any way.