|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.MarshalFramework
org.exolab.castor.xml.UnmarshalHandler
An unmarshaller to allowing unmarshalling of XML documents to Java Objects. The Class must specify the proper access methods (setters/getters) in order for instances of the Class to be properly unmarshalled.
Nested Class Summary | |
---|---|
static class |
MarshalFramework.InheritanceMatch
Used to store the information when we find a possible inheritance. |
(package private) class |
MarshalFramework.InternalXMLClassDescriptor
An internal implementation of XMLClassDescriptor used by the Unmarshaller and Marshaller... |
(package private) class |
UnmarshalHandler.Arguments
Internal class used for passing constructor argument information |
static class |
UnmarshalHandler.ArrayHandler
A class for handling Arrays during unmarshalling. |
(package private) class |
UnmarshalHandler.IDResolverImpl
Local IDResolver |
(package private) class |
UnmarshalHandler.ReferenceInfo
Internal class used to save state for reference resolving |
Field Summary | |
---|---|
(package private) static java.lang.String |
JAVA_PREFIX
The default prefix used for specifying the xsi:type as a classname instead of a schema name. |
(package private) static java.lang.String |
QNAME_NAME
The name of the QName type |
static java.lang.String |
XSI_NAMESPACE
The XSI Namespace URI |
static java.lang.String |
XSI_NO_NAMESPACE_SCHEMA_LOCATION
The name of the no namespace schema location attribute |
static java.lang.String |
XSI_SCHEMA_LOCATION
The name of the Schema location attribute |
Constructor Summary | |
---|---|
protected |
UnmarshalHandler()
Creates a new UnmarshalHandler The "root" class will be obtained by looking into the mapping for a descriptor that matches the root element. |
protected |
UnmarshalHandler(java.lang.Class _class)
Creates a new UnmarshalHandler |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
|
void |
endElement(java.lang.String name)
|
void |
error(org.xml.sax.SAXParseException exception)
|
void |
fatalError(org.xml.sax.SAXParseException exception)
|
CollectionHandler |
getCollectionHandler(java.lang.Class clazz)
Returns the CollectionHandler associated with the given collection, or null if no such handler exists. |
java.lang.Object |
getCurrentObject()
Returns the Object that the UnmarshalHandler is currently handling (within the object model), or null if the current element is a simpleType. |
org.xml.sax.Locator |
getDocumentLocator()
|
java.lang.Object |
getObject()
Returns the "root" Object (ie. |
(package private) static boolean |
hasFieldsAtLocation(java.lang.String location,
XMLClassDescriptor classDesc)
Returns true if any of the fields associated with the given XMLClassDescriptor are located at, or beneath, the given location. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
static boolean |
isCollection(java.lang.Class clazz)
Returns true if the given Class is a considered a collection by the marshalling framework. |
(package private) static boolean |
isPrimitive(java.lang.Class type)
Returns true if the given class should be treated as a primitive type. |
static boolean |
namespaceEquals(java.lang.String ns1,
java.lang.String ns2)
Compares the given namespaces (as strings) for equality. |
(package private) static boolean |
primitiveOrWrapperEquals(java.lang.Class a,
java.lang.Class b)
Returns true if the given classes are both the same primitive or primitive wrapper class. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
static MarshalFramework.InheritanceMatch[] |
searchInheritance(java.lang.String name,
java.lang.String namespace,
XMLClassDescriptor classDesc,
ClassDescriptorResolver cdResolver)
Search there is a field descriptor which can accept one of the class descriptor which match the given name and namespace. |
void |
setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use when loading classes |
void |
setClearCollections(boolean clear)
Sets whether or not to clear collections (including arrays) upon first use to remove default values. |
protected void |
setConfiguration(Configuration config)
Sets the current Castor configuration. |
void |
setDebug(boolean debug)
Turns debuging on or off. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
setIDResolver(IDResolver idResolver)
Sets the IDResolver to use when resolving IDREFs for which no associated element may exist in XML document. |
void |
setIgnoreExtraAttributes(boolean ignoreExtraAtts)
Sets whether or not attributes that do not match a specific field should simply be ignored or reported as an error. |
void |
setIgnoreExtraElements(boolean ignoreExtraElems)
Sets whether or not elements that do not match a specific field should simply be ignored or reported as an error. |
void |
setLogWriter(java.io.PrintWriter printWriter)
Sets the PrintWriter used for printing log messages |
void |
setResolver(ClassDescriptorResolver cdResolver)
Sets the ClassDescriptorResolver to use for loading and resolving ClassDescriptors |
void |
setReuseObjects(boolean reuse)
Sets a boolean that when true indicates that objects contained within the object model should be re-used where appropriate. |
void |
setRootObject(java.lang.Object root)
Sets the root (top-level) object to use for unmarshalling into. |
void |
setUnmarshalListener(UnmarshalListener listener)
Sets an UnmarshalListener . |
void |
setValidation(boolean validate)
Sets the flag for validation |
void |
startDocument()
|
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList attList)
|
static java.lang.Object |
toPrimitiveObject(java.lang.Class type,
java.lang.String value)
Converts a String to the given primitive object type |
void |
warning(org.xml.sax.SAXParseException exception)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String XSI_NAMESPACE
public static final java.lang.String XSI_SCHEMA_LOCATION
public static final java.lang.String XSI_NO_NAMESPACE_SCHEMA_LOCATION
static final java.lang.String JAVA_PREFIX
static final java.lang.String QNAME_NAME
Constructor Detail |
protected UnmarshalHandler()
protected UnmarshalHandler(java.lang.Class _class)
_class
- the Class to create the UnmarshalHandler forMethod Detail |
public java.lang.Object getCurrentObject()
public java.lang.Object getObject()
public void setClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader to usepublic void setClearCollections(boolean clear)
clear
- the boolean value that when true indicates
collections should be cleared upon first use.public void setDebug(boolean debug)
debug
- the flag indicating whether to generate debug information.
A value of true, will turn debuggin on.setLogWriter(java.io.PrintWriter)
public void setIDResolver(IDResolver idResolver)
idResolver
- the IDResolver to use when resolving
IDREFs for which no associated element may exist in the
XML document.public void setIgnoreExtraAttributes(boolean ignoreExtraAtts)
ignoreExtraAtts
- a boolean that when true will
allow non-matched attributes to simply be ignored.public void setIgnoreExtraElements(boolean ignoreExtraElems)
ignoreExtraElems
- a boolean that when true will
allow non-matched attributes to simply be ignored.public void setLogWriter(java.io.PrintWriter printWriter)
printWriter
- the PrintWriter to use when printing
log messagespublic void setReuseObjects(boolean reuse)
reuse
- the boolean indicating whether or not
to re-use existing objects in the object model.public void setResolver(ClassDescriptorResolver cdResolver)
cdResolver
- the ClassDescriptorResolver to usepublic void setRootObject(java.lang.Object root)
root
- the instance to unmarshal into.public void setUnmarshalListener(UnmarshalListener listener)
UnmarshalListener
.
listener
- the UnmarshalListener to use with this instance
of the UnmarshalHandler.public void setValidation(boolean validate)
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String name) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.DocumentHandler
public org.xml.sax.Locator getDocumentLocator()
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String name, org.xml.sax.AttributeList attList) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
protected void setConfiguration(Configuration config)
public static java.lang.Object toPrimitiveObject(java.lang.Class type, java.lang.String value)
type
- the class type of the primitive in which
to convert the String tovalue
- the String to convert to a primitive
public static boolean isCollection(java.lang.Class clazz)
public CollectionHandler getCollectionHandler(java.lang.Class clazz)
static boolean isPrimitive(java.lang.Class type)
static final boolean hasFieldsAtLocation(java.lang.String location, XMLClassDescriptor classDesc)
location
- the location to compare againstclassDesc
- the XMLClassDescriptor in which to check the field
locationspublic static boolean namespaceEquals(java.lang.String ns1, java.lang.String ns2)
ns1
- the namespace to compare to argument ns2ns2
- the namespace to compare to argument ns1static boolean primitiveOrWrapperEquals(java.lang.Class a, java.lang.Class b)
public static MarshalFramework.InheritanceMatch[] searchInheritance(java.lang.String name, java.lang.String namespace, XMLClassDescriptor classDesc, ClassDescriptorResolver cdResolver)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |