protected XMLContext createXMLContext(Resource[] mappingLocations, Class[] targetClasses, String[] targetPackages)
			throws MappingException, ResolverException, IOException {

		XMLContext context = new XMLContext();
		if (!ObjectUtils.isEmpty(mappingLocations)) {
			Mapping mapping = new Mapping();
			for (Resource mappingLocation : mappingLocations) {
				mapping.loadMapping(SaxResourceUtils.createInputSource(mappingLocation));
			}
			context.addMapping(mapping);
		}
		if (!ObjectUtils.isEmpty(targetClasses)) {
			context.addClasses(targetClasses);
		}
		if (!ObjectUtils.isEmpty(targetPackages)) {
			context.addPackages(targetPackages);
		}
		if (this.castorProperties != null) {
			for (Map.Entry<String, String> property : this.castorProperties.entrySet()) {
				context.setProperty(property.getKey(), property.getValue());
			}
		}
		return context;
	}
protected XMLContext createXMLContext ( Resource [ ] mappingLocations , Class [ ] targetClasses , String [ ] targetPackages ) throws MappingException , ResolverException , IOException { XMLContext context = new XMLContext ( ) ; if ( ! ObjectUtils . isEmpty ( mappingLocations ) ) { Mapping mapping = new Mapping ( ) ; for ( Resource mappingLocation : mappingLocations ) { mapping . loadMapping ( SaxResourceUtils . createInputSource ( mappingLocation ) ) ; } context . addMapping ( mapping ) ; } if ( ! ObjectUtils . isEmpty ( targetClasses ) ) { context . addClasses ( targetClasses ) ; } if ( ! ObjectUtils . isEmpty ( targetPackages ) ) { context . addPackages ( targetPackages ) ; } if ( this . castorProperties != null ) { for ( Map . Entry < String , String > property : this . castorProperties . entrySet ( ) ) { context . setProperty ( property . getKey ( ) , property . getValue ( ) ) ; } } return context ; }
Create the Castor {@code XMLContext}. Subclasses can override this to create a custom context.
<p>The default implementation loads mapping files if defined, or the target class or packages if defined.
@return the created resolver
@throws MappingException when the mapping file cannot be loaded
@throws IOException in case of I/O errors
@see XMLContext#addMapping(org.exolab.castor.mapping.Mapping)
@see XMLContext#addClass(Class)