javax.xml.bind.Unmarshaller.Listener Java Examples

The following examples show how to use javax.xml.bind.Unmarshaller.Listener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlPersistenceUtil.java    From recheck with GNU Affero General Public License v3.0 6 votes vote down vote up
static <T extends Persistable> ReTestXmlDataContainer<T> migrateAndRead( final XmlTransformer xml,
		final NamedBufferedInputStream inputStream, final Listener unmarshallListener ) throws IOException {
	NamedBufferedInputStream bin = inputStream;

	final XmlVersionCheckResult checkResult = XmlVersionCheckResult.create( bin );

	if ( checkResult.newDataTypeInstance == null ) {
		throw new RuntimeException( "Unexpected data type " + checkResult.oldDataType );
	}

	if ( !checkResult.isCompatible() ) {
		bin = XmlMigrator.tryToMigrate( checkResult, bin );
		if ( bin == null ) {
			throw new RuntimeException( "Could not migrate XML." );
		}
	}

	return xml.fromXML( bin, unmarshallListener );
}
 
Example #2
Source File: Tools.java    From vethrfolnir-mu with GNU General Public License v3.0 4 votes vote down vote up
public static synchronized void afterUnmarshal(ArrayList<?> list) {
	for (Object object : list) {
		if(object instanceof Listener)
			((Listener) object).afterUnmarshal(null, null);
	}
}
 
Example #3
Source File: Tools.java    From vethrfolnir-mu with GNU General Public License v3.0 4 votes vote down vote up
public static synchronized void afterUnmarshal(Object object) {
	if(object instanceof Listener)
		((Listener) object).afterUnmarshal(null, null);
}