|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.xeril.xml.XmlToObject
This class is used to generate an object from XML
| Constructor Summary | |
XmlToObject()
Constructor. |
|
XmlToObject(boolean validate)
Constructor. |
|
| Method Summary | |
protected java.lang.Object |
getArray(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapDescriptor map_desc)
Gets the array from the node. |
protected java.lang.Object |
getArray(org.w3c.dom.NodeList nodes,
java.lang.Class cl,
XmlMapper mapper)
Gets the array from the node. |
protected java.lang.Object |
getMappedValue(org.w3c.dom.Node node,
XmlMapper mapper)
Gets the value from the node. |
protected java.lang.Object |
getNodeValue(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapper mapper)
Gets the value from the node. |
java.lang.Object |
getObject(java.io.InputStream input,
java.lang.Class cl)
From an xml input stream, tries to create the corresponding object. |
java.lang.Object |
getObject(org.w3c.dom.Node node,
java.lang.Class cl)
Creates the object. |
protected java.lang.Object |
getValue(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapper mapper)
Gets the value from the node. |
protected java.lang.Object |
getValue(java.lang.String stringValue,
java.lang.Class cl,
XmlMapper mapper)
Gets the value from the string value. |
protected XmlMapDescriptor |
getXmlMapDescriptor(java.lang.String xml_name,
XmlInfo info)
Tries to extract the map descriptor from the xml name and info object. |
static void |
main(java.lang.String[] args)
|
protected void |
setField(java.lang.Object o,
org.w3c.dom.Node node,
XmlInfo info)
Sets the field from the node. |
static java.lang.Object |
xmlToObject(java.io.InputStream input,
java.lang.Class cl)
From an xml stream, tries to create the corresponding object. |
static java.lang.Object |
xmlToObject(java.lang.String filename,
java.lang.Class cl)
From an xml file, tries to create the corresponding object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XmlToObject()
public XmlToObject(boolean validate)
validate - to know whether to validate the xml or no| Method Detail |
public static void main(java.lang.String[] args)
throws java.lang.Exception
public static java.lang.Object xmlToObject(java.io.InputStream input,
java.lang.Class cl)
throws XmlToObjectException
input - the input stream from which to read the xmlcl - the class represented by this fileXmlToObjectException - when there is a problem building the
object
public static java.lang.Object xmlToObject(java.lang.String filename,
java.lang.Class cl)
throws XmlToObjectException,
java.io.IOException
filename - the name of the xml file to readcl - the class represented by this fileXmlToObjectException - when there is a problem building the
objectjava.io.IOException - when there is an IO problem
public java.lang.Object getObject(java.io.InputStream input,
java.lang.Class cl)
throws XmlToObjectException
input - the input stream from which to read the xmlcl - the class represented by this fileXmlToObjectException - when there is a problem building the
object
public java.lang.Object getObject(org.w3c.dom.Node node,
java.lang.Class cl)
throws XmlToObjectException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.NoSuchFieldException,
XmlMapperException
node - the starting node (root)cl - the class of the object to generate
protected void setField(java.lang.Object o,
org.w3c.dom.Node node,
XmlInfo info)
throws java.lang.NoSuchFieldException,
XmlToObjectException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlMapperException
o - the object to set the fields onnode - the node from which to extract the fieldinfo - the info object (can be null)
protected java.lang.Object getNodeValue(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapper mapper)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
node - the node from which to extract the valuecl - the class of the value we are supposed to createmapper - the mapper to extract the value
protected java.lang.Object getValue(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapper mapper)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
node - the node from which to extract the valuecl - the class of the value we are supposed to createmapper - the mapper to extract the value
protected java.lang.Object getValue(java.lang.String stringValue,
java.lang.Class cl,
XmlMapper mapper)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
stringValue - the value as a Stringcl - the class of the value we are supposed to createmapper - the mapper to extract the value
protected java.lang.Object getArray(org.w3c.dom.Node node,
java.lang.Class cl,
XmlMapDescriptor map_desc)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
node - the node from which we extract the arraycl - the class of the value we are supposed to createmap_desc - the map descriptor of this node/field
protected java.lang.Object getMappedValue(org.w3c.dom.Node node,
XmlMapper mapper)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
node - the node from which we extract the mapped valuemapper - the mapper to unmap the value
protected java.lang.Object getArray(org.w3c.dom.NodeList nodes,
java.lang.Class cl,
XmlMapper mapper)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
XmlToObjectException,
java.lang.NoSuchFieldException,
XmlMapperException
nodes - the list of nodes from which to extract the array valuescl - the class of the value we are supposed to createmapper - the mapper (indexed)
protected XmlMapDescriptor getXmlMapDescriptor(java.lang.String xml_name,
XmlInfo info)
null is returned.
xml_name - the name of the xml tag we are looking for its map descinfo - the info object that may hold the tag name
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||