本文整理汇总了Java中javax.xml.bind.Marshaller.Listener方法的典型用法代码示例。如果您正苦于以下问题:Java Marshaller.Listener方法的具体用法?Java Marshaller.Listener怎么用?Java Marshaller.Listener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.Marshaller
的用法示例。
在下文中一共展示了Marshaller.Listener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireAfterMarshalEvents
import javax.xml.bind.Marshaller; //导入方法依赖的package包/类
/**
* Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded
* afterMarshal api(if it exists).
*
* This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
*
* @param beanInfo
* @param currentTarget
*/
private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
// first invoke bean embedded listener
if (beanInfo.hasAfterMarshalMethod()) {
Method m = beanInfo.getLifecycleMethods().afterMarshal;
fireMarshalEvent(currentTarget, m);
}
// then invoke external listener before bean embedded listener
Marshaller.Listener externalListener = marshaller.getListener();
if (externalListener != null) {
externalListener.afterMarshal(currentTarget);
}
}
示例2: fireBeforeMarshalEvents
import javax.xml.bind.Marshaller; //导入方法依赖的package包/类
/**
* Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded
* beforeMarshal api(if it exists).
*
* This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
*
* @param beanInfo
* @param currentTarget
*/
private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
// first invoke bean embedded listener
if (beanInfo.hasBeforeMarshalMethod()) {
Method m = beanInfo.getLifecycleMethods().beforeMarshal;
fireMarshalEvent(currentTarget, m);
}
// then invoke external listener
Marshaller.Listener externalListener = marshaller.getListener();
if (externalListener != null) {
externalListener.beforeMarshal(currentTarget);
}
}