|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.bind Class Marshaller.Listener
java.lang.Object javax.xml.bind.Marshaller.Listener
- Enclosing interface:
- Marshaller
public abstract static class Marshaller.Listener
- extends Object
向 Marshaller
注册此类的一个实现的实例,以从外部侦听编组事件。
此类支持对每个已编组的对象进行预处理和后处理。从映射到 xml 元素或复杂类型定义的实例进行编组时,将调用事件回调。从表示简单类型定义的 Java 数据类型的实例进行编组时,不需要调用事件回调。
外部侦听器是用于定义编组事件回调的两个不同机制之一。请参阅 Marshal Event Callbacks 获得对方面的概括。
since | JAXB2.0 |
See also | setListener(Listener), getListener() |
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 |
---|
public
Marshaller.Listener()
英文文档:
Marshaller.Listener
public Marshaller.Listener()
Method Detail |
---|
public void
beforeMarshal(Object source)
从 source 编组到 XML 之前调用的回调方法。
只在编组进程开始编组 source 之前才调用此方法。注意,如果 source 的类定义了自己的 beforeMarshal 方法,则只在调用此方法之前调用特定于类的回调方法。
source | 编组之前的 JAXB 映射类的实例。 |
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.
public void
afterMarshal(Object source)
将 source 编组到 XML 之后调用的回调方法。
在编组 source 及其所有子代之前调用此方法。注意,如果 source 的类定义了自己的 afterMarshal 方法,则只在调用此方法之前调用特定于类的回调方法。
source | 编组之后的 JAXB 映射类的实例。 |
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!