public class XMLContext
extends java.lang.Object
Constructor | Description |
---|---|
XMLContext() |
Creates an instance of
XMLContext with an internal XML context. |
Modifier and Type | Method | Description |
---|---|---|
void |
addClass(java.lang.Class clazz) |
Loads the class descriptor for the class instance specified.
|
void |
addClasses(java.lang.Class[] clazzes) |
Loads the class descriptor for the class instance specified.
|
void |
addMapping(Mapping mapping) |
Instructs Castor to load class descriptors from the mapping given.
|
void |
addPackage(java.lang.String packageName) |
Loads class descriptors from the package specified.
|
void |
addPackages(java.lang.String[] packageNames) |
Loads class descriptors from the packages specified.
|
ChangeLog2XML |
createChangeLog2XML() |
To create a new
ChangeLog2XML instance. |
Mapping |
createMapping() |
Creates an instance of a Castor XML specific
Mapping instance. |
MappingTool |
createMappingTool() |
To create a MappingTool instance.
|
Marshaller |
createMarshaller() |
Creates a new
Marshaller instance to be used for marshalling. |
Unmarshaller |
createUnmarshaller() |
Creates a new
Unmarshaller instance to be used for unmarshalling. |
InternalContext |
getInternalContext() |
Deprecated.
|
java.lang.Object |
getProperty(java.lang.String propertyName) |
To get the value of a specific property.
|
void |
setClassLoader(java.lang.ClassLoader classLoader) |
Sets a custom
ClassLoader to be used for loading classes. |
void |
setProperty(java.lang.String propertyName,
boolean value) |
To set properties for marshalling and unmarshalling behavior.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value) |
To set properties for marshalling and unmarshalling behavior.
|
public XMLContext()
XMLContext
with an internal XML context.public void addMapping(Mapping mapping) throws MappingException
mapping
- Castor XML mapping (file), from which the required class
descriptors will be derived.MappingException
- If the Mapping
cannot be loaded and analyzed successfully.public void addClass(java.lang.Class clazz) throws ResolverException
clazz
- the class for which the associated descriptor should be loaded.ResolverException
- in case that resolving the Class fails fatallypublic void addClasses(java.lang.Class[] clazzes) throws ResolverException
clazzes
- the classes for which the associated descriptor should be loaded.ResolverException
- in case that resolving the Class fails fatallypublic void addPackage(java.lang.String packageName) throws ResolverException
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) classesResolverException
- If there's a problem loading class descriptors for the given package.public void addPackages(java.lang.String[] packageNames) throws ResolverException
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) classesResolverException
- If there's a problem loading class descriptors for the given package.public Mapping createMapping()
Mapping
instance.Mapping
instance.public Marshaller createMarshaller()
Marshaller
instance to be used for marshalling.Marshaller
instance.public Unmarshaller createUnmarshaller()
Unmarshaller
instance to be used for unmarshalling.Unmarshaller
instance, preconfigured with
a XMLClassDescriptorResolver
instance with the class
descriptors cached as loaded above.public MappingTool createMappingTool()
public ChangeLog2XML createChangeLog2XML()
ChangeLog2XML
instance.ChangeLog2XML
instance ready to usepublic void setProperty(java.lang.String propertyName, java.lang.Object value)
propertyName
- name of the property to setvalue
- the value to set topublic void setProperty(java.lang.String propertyName, boolean value)
propertyName
- name of the property to setvalue
- the value to set topublic java.lang.Object getProperty(java.lang.String propertyName)
propertyName
- name of the Propertypublic InternalContext getInternalContext()
InternalContext
as used when instantiating other
classes. Mind that this method is only used in tests and should
NOT be used in production code!InternalContext
usedpublic void setClassLoader(java.lang.ClassLoader classLoader)
ClassLoader
to be used for loading classes.classLoader
- A custom ClassLoader
.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com