org.exolab.castor.xml
Class XMLContext
java.lang.Object
org.exolab.castor.xml.XMLContext
public class XMLContext
extends java.lang.Object
Bootstrap class for Castor XML that allows you to load information about the
domain objects used with Castor XML (marshallers and unmarshallers) by various means.
XMLContext
public XMLContext()
Creates an instance of
XMLContext
with an internal XML context.
addClass
public void addClass(Class clazz)
throws ResolverException
Loads the class descriptor for the class instance specified. The use of this method is useful
when no mapping is used, as happens when the domain classes has been generated
using the XML code generator (in which case instead of a mapping file class
descriptor files will be generated).
clazz
- the class for which the associated descriptor should be loaded.
addClasses
public void addClasses(Class[] clazzes)
throws ResolverException
Loads the class descriptor for the class instance specified. The use of this method is useful
when no mapping is used, as happens when the domain classes hase been generated
using the XML code generator (in which case instead of a mapping file class
descriptor files will be generated).
clazzes
- the classes for which the associated descriptor should be loaded.
addMapping
public void addMapping(Mapping mapping)
throws MappingException
Instructs Castor to load class descriptors from the mapping given.
mapping
- Castor XML mapping (file), from which the required class
descriptors will be derived.
addPackage
public void addPackage(String packageName)
throws ResolverException
Loads class descriptors from the package specified. The use of this method is useful
when no mapping is used, as happens when the domain classes hase been generated
using the XML code generator (in which case instead of a mapping file class
descriptor files will be generated).
Please note that this functionality will work only if you provide the
.castor.cdr
file with your generated classes (as generated by the XML code generator).
packageName
- The package name for the (descriptor) classes
ResolverException
- If there's a problem loading class descriptors for the given package.
addPackages
public void addPackages(String[] packageNames)
throws ResolverException
Loads class descriptors from the packages specified. The use of this method is useful
when no mapping is used, as happens when the domain classes hase been generated
using the XML code generator (in which case instead of a mapping file class
descriptor files will be generated).
Please note that this functionality will work only if you provide the
.castor.cdr
files with your generated classes (as generated by the XML code generator).
packageNames
- The package names for the (descriptor) classes
ResolverException
- If there's a problem loading class descriptors for the given package.
createMapping
public Mapping createMapping()
Creates an instance of a Castor XML specific
Mapping
instance.
- a Castor XML specific
Mapping
instance.
createMappingTool
public MappingTool createMappingTool()
To create a MappingTool instance.
- the MappingTool instance ready to use
createMarshaller
public Marshaller createMarshaller()
Creates a new
Marshaller
instance to be used for marshalling.
createUnmarshaller
public Unmarshaller createUnmarshaller()
Creates a new
Unmarshaller
instance to be used for unmarshalling.
getInternalContext
public InternalContext getInternalContext()
To get the
InternalContext
as used when instantiating other
classes. Mind that this method is only used in tests and should
NOT be used in production code!
getProperty
public Object getProperty(String propertyName)
To get the value of a specific property.
propertyName
- name of the Property
- the value (Object) of the property
setProperty
public void setProperty(String propertyName,
Object value)
To set properties for marshalling and unmarshalling behavior.
propertyName
- name of the property to setvalue
- the value to set to
setProperty
public void setProperty(String propertyName,
boolean value)
To set properties for marshalling and unmarshalling behavior.
propertyName
- name of the property to setvalue
- the value to set to
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com