|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dom4j.tree.AbstractNode
org.dom4j.tree.AbstractBranch
org.dom4j.tree.AbstractElement
org.dom4j.tree.DefaultElement
de.fu_berlin.ties.xml.io.ObjectElement
public class ObjectElement
An XML element that is targeted at storing an Java object.
Field Summary | |
---|---|
static String |
JAVA_CLASS_ATTRIBUTE
The name of the attribute used to store the Java class of an object: "java". |
Fields inherited from class org.dom4j.tree.AbstractElement |
---|
EMPTY_ITERATOR, EMPTY_LIST, USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING |
Fields inherited from class org.dom4j.tree.AbstractBranch |
---|
DEFAULT_CONTENT_LIST_SIZE, outputFormat |
Fields inherited from class org.dom4j.tree.AbstractNode |
---|
NODE_TYPE_NAMES |
Fields inherited from interface org.dom4j.Node |
---|
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE |
Constructor Summary | |
---|---|
ObjectElement(QName qname,
Class javaClass)
Creates a new instance. |
|
ObjectElement(String name,
Class javaClass)
Creates a new instance. |
|
ObjectElement(String name,
Namespace namespace,
Class javaClass)
Creates a new instance. |
Method Summary | |
---|---|
Object |
createObject()
Creates (deserializes) an object of a specified type by calling a constructor of the class that accepts an XML element as single argument and passing itself as parameter. |
static Object |
createObject(Element element,
Class type)
Creates (deserializes) an object of a specified type by calling a constructor of the class that accepts an XML element as single argument and passing itself as parameter. |
Class |
javaClass()
Returns the Class of the stored object. |
String |
javaClassName()
Returns the name of the Class of the stored object. |
boolean |
unsetJavaClassAttrib()
Unsets the attribute representing the Class of the stored object. |
Methods inherited from class org.dom4j.tree.AbstractBranch |
---|
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructions |
Methods inherited from class org.dom4j.tree.AbstractNode |
---|
asXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.dom4j.Element |
---|
getTextTrim |
Methods inherited from interface org.dom4j.Branch |
---|
addElement, addElement, appendContent, content, elementByID, setProcessingInstructions |
Methods inherited from interface org.dom4j.Node |
---|
asXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf |
Field Detail |
---|
public static final String JAVA_CLASS_ATTRIBUTE
Constructor Detail |
---|
public ObjectElement(String name, Class javaClass)
name
- the name of the elementjavaClass
- the class of the object to storepublic ObjectElement(QName qname, Class javaClass)
qname
- the qualified name of the elementjavaClass
- the class of the object to storepublic ObjectElement(String name, Namespace namespace, Class javaClass)
name
- the local name of the elementnamespace
- the namespace of the elementjavaClass
- the class of the object to storeMethod Detail |
---|
public static final Object createObject(Element element, Class type) throws InstantiationException, SecurityException
type
- the class of the object to create; must have a constructor
whose only argument is an Element
InstantiationException
- if instantiation failed
SecurityException
- if access to the required reflection
information is deniedpublic final Object createObject() throws InstantiationException, SecurityException, ClassNotFoundException, IllegalStateException
InstantiationException
- if instantiation failed
SecurityException
- if access to the required reflection
information is denied
ClassNotFoundException
- if the class specified in the
JAVA_CLASS_ATTRIBUTE
is not available on this system
IllegalStateException
- if the java class attribute has been
removed (by calling unsetJavaClassAttrib()
public String javaClassName()
Class
of the stored object.
null
if
unsetJavaClassAttrib()
has been called beforepublic Class javaClass() throws ClassNotFoundException, IllegalStateException
Class
of the stored object.
ClassNotFoundException
- if the class cannot be located
IllegalStateException
- if the java class attribute has been
removed (by calling unsetJavaClassAttrib()
public boolean unsetJavaClassAttrib()
Class
of the stored object.
true
if the attribute was successfully removed
(first call to this method); false
if there was no such
attribute (later calls to this method)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |