本文整理汇总了Java中javax.xml.bind.Unmarshaller.Listener方法的典型用法代码示例。如果您正苦于以下问题:Java Unmarshaller.Listener方法的具体用法?Java Unmarshaller.Listener怎么用?Java Unmarshaller.Listener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.Unmarshaller
的用法示例。
在下文中一共展示了Unmarshaller.Listener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireBeforeUnmarshal
import javax.xml.bind.Unmarshaller; //导入方法依赖的package包/类
/**
* Fires the beforeUnmarshal event if necessary.
*
* @param state
* state of the newly create child object.
*/
protected final void fireBeforeUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException {
if(beanInfo.lookForLifecycleMethods()) {
UnmarshallingContext context = state.getContext();
Unmarshaller.Listener listener = context.parent.getListener();
if(beanInfo.hasBeforeUnmarshalMethod()) {
beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.getPrev().getTarget());
}
if(listener!=null) {
listener.beforeUnmarshal(child, state.getPrev().getTarget());
}
}
}
示例2: fireAfterUnmarshal
import javax.xml.bind.Unmarshaller; //导入方法依赖的package包/类
/**
* Fires the afterUnmarshal event if necessary.
*
* @param state
* state of the parent object
*/
protected final void fireAfterUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException {
// fire the event callback
if(beanInfo.lookForLifecycleMethods()) {
UnmarshallingContext context = state.getContext();
Unmarshaller.Listener listener = context.parent.getListener();
if(beanInfo.hasAfterUnmarshalMethod()) {
beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.getTarget());
}
if(listener!=null)
listener.afterUnmarshal(child, state.getTarget());
}
}