javax.xml.bind.Unmarshaller#Listener ( )源码实例Demo

下面列出了javax.xml.bind.Unmarshaller#Listener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: Loader.java
/**
 * 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 项目: openjdk-8   文件: Loader.java
/**
 * 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.target);
        }
        if(listener!=null)
            listener.afterUnmarshal(child, state.target);
    }
}
 
源代码3 项目: jdk8u60   文件: Loader.java
/**
 * 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());
    }
}
 
源代码4 项目: recheck   文件: XmlTransformer.java
public <T> T fromXML( final InputStream in, final Unmarshaller.Listener listener ) {
	try {
		final JAXBContext jc = createJAXBContext( additionalClazzes );
		final Unmarshaller unmarshaller = jc.createUnmarshaller();
		unmarshaller.setEventHandler( new DefaultValidationEventHandler() );
		unmarshaller.setListener( listener );

		@SuppressWarnings( "unchecked" )
		final T result = (T) unmarshaller.unmarshal( in );
		return result;

	} catch ( final JAXBException e ) {
		throw new RuntimeException( e );
	}
}
 
源代码5 项目: recheck   文件: ScreenshotFolderPersistence.java
public Unmarshaller.Listener getUnmarshallListener() {
	return new Unmarshaller.Listener() {
		@Override
		public void afterUnmarshal( final Object target, final Object parent ) {
			if ( target instanceof Screenshot ) {
				if ( !loadScreenshot( (Screenshot) target ) ) {
					parentsWithIncorrectScreenshots.put( parent, (Screenshot) target );
				}
			} else if ( parentsWithIncorrectScreenshots.containsKey( target ) ) {
				ReflectionUtilities.setChildInParentToNull( target, parentsWithIncorrectScreenshots.get( target ) );
			}
		}
	};
}
 
JsonProviderPrototypeServiceFactory(
    Dictionary<String, ?> properties,
    Optional<TypeConverter> typeConverter,
    Optional<Marshaller.Listener> marshallerListener,
    Optional<Unmarshaller.Listener> unmarshallerListener,
    Optional<SchemaHandler> schemaHandler
) {
    _properties = properties;
    _typeConverter = typeConverter;
    _marshallerListener = marshallerListener;
    _unmarshallerListener = unmarshallerListener;
    _schemaHandler = schemaHandler;
}
 
源代码7 项目: openjdk-jdk8u   文件: Loader.java
/**
 * 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());
        }
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: Loader.java
/**
 * 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());
    }
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: Loader.java
/**
 * 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());
        }
    }
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: Loader.java
/**
 * 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());
    }
}
 
源代码11 项目: openjdk-jdk9   文件: Loader.java
/**
 * 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());
        }
    }
}
 
源代码12 项目: openjdk-jdk9   文件: Loader.java
/**
 * 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());
    }
}
 
源代码13 项目: hottub   文件: Loader.java
/**
 * 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());
        }
    }
}
 
源代码14 项目: hottub   文件: Loader.java
/**
 * 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());
    }
}
 
源代码15 项目: openjdk-8-source   文件: Loader.java
/**
 * 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.prev.target);
        }
        if(listener!=null) {
            listener.beforeUnmarshal(child, state.prev.target);
        }
    }
}
 
源代码16 项目: openjdk-8-source   文件: Loader.java
/**
 * 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.target);
        }
        if(listener!=null)
            listener.afterUnmarshal(child, state.target);
    }
}
 
源代码17 项目: cxf   文件: AbstractJAXBProvider.java
public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener) {
    this.unmarshallerListener = unmarshallerListener;
}
 
源代码18 项目: java-technology-stack   文件: Jaxb2Marshaller.java
/**
 * Set the {@code Unmarshaller.Listener} to be registered with the JAXB {@code Unmarshaller}.
 */
public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener) {
	this.unmarshallerListener = unmarshallerListener;
}
 
源代码19 项目: spring4-understanding   文件: Jaxb2Marshaller.java
/**
 * Set the {@code Unmarshaller.Listener} to be registered with the JAXB {@code Unmarshaller}.
 */
public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener) {
	this.unmarshallerListener = unmarshallerListener;
}
 
源代码20 项目: cxf   文件: JAXBDataBinding.java
/**
 * Sets the Unmarshaller.Listener that will be registered on the Unmarshallers
 * @param unmarshallerListener
 */
public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener) {
    this.unmarshallerListener = unmarshallerListener;
}