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

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

源代码1 项目: TencentKona-8   文件: XMLSerializer.java
/**
 * 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 项目: TencentKona-8   文件: XMLSerializer.java
/**
 * 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);
    }
}
 
源代码3 项目: jdk8u60   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
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;
}
 
源代码5 项目: recheck   文件: XmlTransformer.java
public void toXML( final Object obj, final OutputStream out, final Marshaller.Listener listener ) {
	Marshaller marshaller = null;
	try {
		final JAXBContext jc = createJAXBContext( additionalClazzes );
		marshaller = jc.createMarshaller();
		marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
		marshaller.setProperty( MarshallerProperties.NAMESPACE_PREFIX_MAPPER,
				new MapNamespacePrefixMapper( NAMESPACE_MAPPINGS ) );
		marshaller.setProperty( MarshallerProperties.INDENT_STRING, "\t" );
		marshaller.setEventHandler( new DefaultValidationEventHandler() );
		marshaller.setListener( listener );
		final SessionLogDelegate sessionLog = new SessionLogDelegate( AbstractSessionLog.getLog() );
		AbstractSessionLog.setLog( sessionLog );

		if ( config.isOnlyFragment() ) {
			log.info( "Create only fragment for '{}'.", obj );
			marshaller.setProperty( Marshaller.JAXB_FRAGMENT, true );
		}

		if ( config.isLightweightXml() ) {
			log.info( "Use lightweight XML for '{}'.", obj );
			lightweightMarshallerSet.add( marshaller );
			XmlUtil.addLightWeightAdapter( marshaller );
		}

		marshaller.marshal( obj, out );

		if ( sessionLog.containsMessages() ) {
			throw new RuntimeException( "Error persisting XML: " + sessionLog.getLog() );
		}
	} catch ( final JAXBException e ) {
		throw new RuntimeException( e );
	} finally {
		if ( config.isLightweightXml() && marshaller != null ) {
			lightweightMarshallerSet.remove( marshaller );
		}
	}
}
 
源代码6 项目: recheck   文件: ScreenshotFolderPersistence.java
public Marshaller.Listener getMarshallListener() {
	return new Marshaller.Listener() {
		@Override
		public void afterMarshal( final Object source ) {
			if ( source instanceof Screenshot ) {
				if ( !prepared ) {
					prepare();
				}
				saveScreenshot( (Screenshot) source );
			}
		}
	};
}
 
源代码7 项目: openjdk-jdk8u   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码8 项目: openjdk-jdk8u-backup   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码9 项目: openjdk-jdk8u-backup   文件: XMLSerializer.java
/**
 * 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);
    }
}
 
源代码10 项目: openjdk-jdk9   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码11 项目: hottub   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码12 项目: openjdk-8   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码13 项目: openjdk-8-source   文件: XMLSerializer.java
/**
 * 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);
    }

}
 
源代码14 项目: openjdk-8   文件: XMLSerializer.java
/**
 * 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);
    }
}
 
源代码15 项目: spring-analysis-note   文件: Jaxb2Marshaller.java
/**
 * Specify the {@code Marshaller.Listener} to be registered with the JAXB {@code Marshaller}.
 */
public void setMarshallerListener(Marshaller.Listener marshallerListener) {
	this.marshallerListener = marshallerListener;
}
 
源代码16 项目: java-technology-stack   文件: Jaxb2Marshaller.java
/**
 * Specify the {@code Marshaller.Listener} to be registered with the JAXB {@code Marshaller}.
 */
public void setMarshallerListener(Marshaller.Listener marshallerListener) {
	this.marshallerListener = marshallerListener;
}
 
源代码17 项目: cxf   文件: AbstractJAXBProvider.java
public void setMarshallerListener(Marshaller.Listener marshallerListener) {
    this.marshallerListener = marshallerListener;
}
 
源代码18 项目: spring4-understanding   文件: Jaxb2Marshaller.java
/**
 * Specify the {@code Marshaller.Listener} to be registered with the JAXB {@code Marshaller}.
 */
public void setMarshallerListener(Marshaller.Listener marshallerListener) {
	this.marshallerListener = marshallerListener;
}
 
源代码19 项目: cxf   文件: JAXBDataBinding.java
/**
 * Sets the Marshaller.Listener that will be registered on the Marshallers
 * @param marshallerListener
 */
public void setMarshallerListener(Marshaller.Listener marshallerListener) {
    this.marshallerListener = marshallerListener;
}
 
源代码20 项目: cxf   文件: JAXBDataBinding.java
/**
 * Returns the Marshaller.Listener that will be registered on the Marshallers
 * @return
 */
public Marshaller.Listener getMarshallerListener() {
    return marshallerListener;
}