|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.Unmarshaller
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.
Field Summary | |
(package private) org.xml.sax.EntityResolver |
entityResolver
The EntityResolver used for resolving entities |
Constructor Summary | |
Unmarshaller(java.lang.Class c)
Creates a new Unmarshaller with the given Class |
|
Unmarshaller(java.lang.Class c,
java.lang.ClassLoader loader)
Creates a new Unmarshaller with the given Class |
|
Unmarshaller(Mapping mapping)
Creates a new Unmarshaller with the given Mapping |
Method Summary | |
UnmarshalHandler |
createHandler()
Creates and initalizes an UnmarshalHandler |
void |
setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use when loading new classes |
void |
setDebug(boolean debug)
Turns debuging on or off. |
void |
setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Sets the EntityResolver to use when resolving system and public ids with respect to entites and Document Type. |
void |
setIDResolver(IDResolver idResolver)
Sets the IDResolver to use when resolving IDREFs for which no associated element may exist in XML document. |
void |
setLogWriter(java.io.PrintWriter printWriter)
Sets the PrintWriter used for logging |
void |
setMapping(Mapping mapping)
Sets the Mapping to use during unmarshalling. |
void |
setResolver(ClassDescriptorResolver cdr)
Sets the ClassDescriptorResolver to use during unmarshalling |
void |
setValidation(boolean validate)
Sets the flag for validation |
static java.lang.Object |
unmarshal(java.lang.Class c,
org.xml.sax.InputSource source)
Unmarshals Objects of the given Class type. |
static java.lang.Object |
unmarshal(java.lang.Class c,
org.w3c.dom.Node node)
Unmarshals Objects of the given Class type. |
static java.lang.Object |
unmarshal(java.lang.Class c,
java.io.Reader reader)
Unmarshals Objects of the given Class type. |
java.lang.Object |
unmarshal(EventProducer eventProducer)
Unmarshals Objects of this Unmarshaller's Class type. |
java.lang.Object |
unmarshal(org.xml.sax.InputSource source)
Unmarshals Objects of this Unmarshaller's Class type. |
java.lang.Object |
unmarshal(org.w3c.dom.Node node)
Unmarshals Objects of this Unmarshaller's Class type. |
java.lang.Object |
unmarshal(java.io.Reader reader)
Unmarshals Objects of this Unmarshaller's Class type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
org.xml.sax.EntityResolver entityResolver
Constructor Detail |
public Unmarshaller(java.lang.Class c)
c
- the Class to create the Unmarshaller for, this
may be null, if the Unmarshaller#setMapping is called
to load a mapping for the root element of xml document.public Unmarshaller(java.lang.Class c, java.lang.ClassLoader loader)
c
- the Class to create the Unmarshaller for, this
may be null, if the Unmarshaller#setMapping is called
to load a mapping for the root element of xml document.public Unmarshaller(Mapping mapping) throws MappingException
Method Detail |
public void setClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader to usepublic 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 setEntityResolver(org.xml.sax.EntityResolver entityResolver)
entityResolver
- the EntityResolver to use when
resolving System and Public ids.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 setLogWriter(java.io.PrintWriter printWriter)
printWriter
- the PrintWriter to use for loggingpublic void setMapping(Mapping mapping) throws MappingException
mapping
- the Mapping to use during unmarshalling.
MappingException
setResolver(org.exolab.castor.xml.ClassDescriptorResolver)
public void setResolver(ClassDescriptorResolver cdr)
cdr
- the ClassDescriptorResolver to use
Note: This method will nullify any Mapping
currently being used by this Unmarshaller
public void setValidation(boolean validate)
public java.lang.Object unmarshal(java.io.Reader reader) throws MarshalException, ValidationException
reader
- the Reader to read the XML from
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic java.lang.Object unmarshal(EventProducer eventProducer) throws MarshalException, ValidationException
eventProducer
- the EventProducer which produces
the SAX events
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic java.lang.Object unmarshal(org.xml.sax.InputSource source) throws MarshalException, ValidationException
source
- the InputSource to read the XML from
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic java.lang.Object unmarshal(org.w3c.dom.Node node) throws MarshalException, ValidationException
node
- the DOM node to read the XML from
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic static java.lang.Object unmarshal(java.lang.Class c, java.io.Reader reader) throws MarshalException, ValidationException
c
- the Class to create a new instance ofreader
- the Reader to read the XML from
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic static java.lang.Object unmarshal(java.lang.Class c, org.xml.sax.InputSource source) throws MarshalException, ValidationException
c
- the Class to create a new instance ofsource
- the InputSource to read the XML from
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic static java.lang.Object unmarshal(java.lang.Class c, org.w3c.dom.Node node) throws MarshalException, ValidationException
c
- the Class to create a new instance of
MarshalException
- when there is an error during
the unmarshalling process
ValidationException
- when there is a validation errorpublic UnmarshalHandler createHandler()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |