Java Code Examples for org.exolab.castor.xml.Unmarshaller#setResolver()

The following examples show how to use org.exolab.castor.xml.Unmarshaller#setResolver() . 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: CastorMarshaller.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Template method that allows for customizing of the given Castor {@link Unmarshaller}.
 */
protected void customizeUnmarshaller(Unmarshaller unmarshaller) {
	unmarshaller.setValidation(this.validating);
	unmarshaller.setWhitespacePreserve(this.whitespacePreserve);
	unmarshaller.setIgnoreExtraAttributes(this.ignoreExtraAttributes);
	unmarshaller.setIgnoreExtraElements(this.ignoreExtraElements);
	unmarshaller.setObject(this.rootObject);
	unmarshaller.setReuseObjects(this.reuseObjects);
	unmarshaller.setClearCollections(this.clearCollections);
	if (this.namespaceToPackageMapping != null) {
		this.namespaceToPackageMapping.forEach(unmarshaller::addNamespaceToPackageMapping);
	}
	if (this.entityResolver != null) {
		unmarshaller.setEntityResolver(this.entityResolver);
	}
	if (this.classDescriptorResolver != null) {
		unmarshaller.setResolver(this.classDescriptorResolver);
	}
	if (this.idResolver != null) {
		unmarshaller.setIDResolver(this.idResolver);
	}
	if (this.objectFactory != null) {
		unmarshaller.setObjectFactory(this.objectFactory);
	}
	if (this.beanClassLoader != null) {
		unmarshaller.setClassLoader(this.beanClassLoader);
	}
}
 
Example 2
Source File: CastorMarshaller.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Template method that allows for customizing of the given Castor {@link Unmarshaller}.
 */
protected void customizeUnmarshaller(Unmarshaller unmarshaller) {
	unmarshaller.setValidation(this.validating);
	unmarshaller.setWhitespacePreserve(this.whitespacePreserve);
	unmarshaller.setIgnoreExtraAttributes(this.ignoreExtraAttributes);
	unmarshaller.setIgnoreExtraElements(this.ignoreExtraElements);
	unmarshaller.setObject(this.rootObject);
	unmarshaller.setReuseObjects(this.reuseObjects);
	unmarshaller.setClearCollections(this.clearCollections);
	if (this.namespaceToPackageMapping != null) {
		for (Map.Entry<String, String> mapping : this.namespaceToPackageMapping.entrySet()) {
			unmarshaller.addNamespaceToPackageMapping(mapping.getKey(), mapping.getValue());
		}
	}
	if (this.entityResolver != null) {
		unmarshaller.setEntityResolver(this.entityResolver);
	}
	if (this.classDescriptorResolver != null) {
		unmarshaller.setResolver(this.classDescriptorResolver);
	}
	if (this.idResolver != null) {
		unmarshaller.setIDResolver(this.idResolver);
	}
	if (this.objectFactory != null) {
		unmarshaller.setObjectFactory(this.objectFactory);
	}
	if (this.beanClassLoader != null) {
		unmarshaller.setClassLoader(this.beanClassLoader);
	}
}