org.exolab.castor.mapping
public final class Mapping extends Object
Multiple mapping files can be loaded with the same Mapping object. When loading master mapping files that include other mapping files it might be convenient to use Mapping or Mapping.
If the desired class loader is different than the one used by Castor (e.g. if Castor is installed as a Java extension), the Mapping object can be constructed with the proper class loader.
The following example loads two mapping files:
Mapping mapping; mapping = new Mapping( getClass().getClassLoader() ); mapping.loadMapping( "mapping.xml" ); mapping.loadMapping( url );
Version: $Revision: 6312 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Constructor Summary | |
---|---|
Mapping(ClassLoader loader)
Constructs a new mapping.
| |
Mapping()
Constructs a new mapping. |
Method Summary | |
---|---|
ClassLoader | getClassLoader()
Returns the class loader used by this mapping object. |
List | getMappingSources()
Get list of mapping sources to resolve.
|
MappingRoot | getRoot()
Get the loaded mapping.
|
void | loadMapping(String url)
Loads the mapping from the specified URL with type defaults to
'CastorXmlMapping'. |
void | loadMapping(String url, String type)
Loads the mapping from the specified URL. |
void | loadMapping(URL url)
Loads the mapping from the specified URL with type defaults to
'CastorXmlMapping'.
|
void | loadMapping(URL url, String type)
Loads the mapping from the specified URL.
|
void | loadMapping(InputSource source)
Loads the mapping from the specified input source with type defaults to
'CastorXmlMapping'.
|
void | loadMapping(InputSource source, String type)
Loads the mapping from the specified input source.
|
void | markAsProcessed(Object id)
Marks the given mapping as having been processed.
|
boolean | processed(Object id)
Returns true if the given systemID or stream has been marked as processed.
|
void | setBaseURL(String url)
Sets the base URL for the mapping and related files. |
void | setEntityResolver(EntityResolver resolver)
Sets the entity resolver. |
Parameters: loader The class loader to use, null for the default
Returns: The class loader used by this mapping object (may be null)
Returns: List of mapping sources to resolve.
Throws: MappingException If no mapping source has been loaded previously.
Returns: The loaded mapping.
Parameters: url The URL of the mapping file.
Throws: IOException An error occured when reading the mapping file. MappingException The mapping file is invalid.
Parameters: url The URL of the mapping file. type The source type.
Throws: IOException An error occured when reading the mapping file. MappingException The mapping file is invalid.
Parameters: url The URL of the mapping file.
Throws: IOException An error occured when reading the mapping file. MappingException The mapping file is invalid.
Parameters: url The URL of the mapping file. type The source type.
Throws: IOException An error occured when reading the mapping file. MappingException The mapping file is invalid.
Parameters: source The input source.
Parameters: source The input source. type The source type.
Parameters: id systemID or stream to identify the mapping to mark.
Parameters: id systemID or stream to check for being marked as processed.
Returns: true if the given systemID or stream has been marked as processed.
Parameters: url The base URL
Parameters: resolver The entity resolver to use