org.dom4j.bean
Class BeanElement

java.lang.Object
  extended by org.dom4j.tree.AbstractNode
      extended by org.dom4j.tree.AbstractBranch
          extended by org.dom4j.tree.AbstractElement
              extended by org.dom4j.tree.DefaultElement
                  extended by org.dom4j.bean.BeanElement
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Branch, Element, Node

public class BeanElement
extends DefaultElement

BeanElement uses a Java Bean to store its attributes.

Version:
$Revision: 1.15 $
Author:
James Strachan
See Also:
Serialized Form

Field Summary
 
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
 
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
BeanElement(QName qname)
           
BeanElement(QName qname, java.lang.Object bean)
           
BeanElement(java.lang.String name, Namespace namespace, java.lang.Object bean)
           
BeanElement(java.lang.String name, java.lang.Object bean)
           
 
Method Summary
 Element addAttribute(QName qName, java.lang.String value)
           Adds the attribute value of the given fully qualified name.
 Element addAttribute(java.lang.String name, java.lang.String value)
           Adds the attribute value of the given local name.
 Attribute attribute(QName qname)
          DOCUMENT ME!
 Attribute attribute(java.lang.String name)
          Returns the attribute with the given name
protected  java.util.List createAttributeList()
          A Factory Method pattern which lazily creates a List implementation used to store content
protected  java.util.List createAttributeList(int size)
          A Factory Method pattern which creates a List implementation used to store attributes
protected  BeanAttributeList getBeanAttributeList()
           
 java.lang.Object getData()
          DOCUMENT ME!
protected  DocumentFactory getDocumentFactory()
           
 void setAttributes(org.xml.sax.Attributes attributes, NamespaceStack namespaceStack, boolean noNamespaceAttributes)
          This method provides a more optimal way of setting all the attributes on an Element particularly for use in SAXReader.
 void setAttributes(java.util.List attributes)
          Sets the attributes that this element contains
 void setData(java.lang.Object data)
          Sets the data value of this element if this element supports data binding or calls Node.setText(java.lang.String)if it doesn't
 
Methods inherited from class org.dom4j.tree.DefaultElement
add, additionalNamespaces, additionalNamespaces, addNewNode, attribute, attribute, attributeCount, attributeIterator, attributeList, attributeList, attributes, clearContent, clone, contentList, declaredNamespaces, element, element, element, getDocument, getNamespaceForPrefix, getNamespaceForURI, getParent, getQName, getStringValue, getText, indexOf, node, nodeCount, nodeIterator, processingInstruction, processingInstructions, processingInstructions, remove, removeNode, removeProcessingInstruction, setAttributeList, setContent, setDocument, setParent, setQName, supportsParent
 
Methods inherited from class org.dom4j.tree.AbstractElement
accept, add, add, add, add, add, add, add, add, addCDATA, addComment, addElement, addEntity, addNamespace, addNewNode, addNode, addNode, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attributeValue, attributeValue, attributeValue, attributeValue, childAdded, childRemoved, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getName, getNamespace, getNamespacePrefix, getNamespacesForURI, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, isRootElement, isTextOnly, normalize, remove, remove, remove, remove, remove, remove, remove, remove, setAttributeValue, setAttributeValue, setName, setNamespace, setText, toString, write
 
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
 

Constructor Detail

BeanElement

public BeanElement(java.lang.String name,
                   java.lang.Object bean)

BeanElement

public BeanElement(java.lang.String name,
                   Namespace namespace,
                   java.lang.Object bean)

BeanElement

public BeanElement(QName qname,
                   java.lang.Object bean)

BeanElement

public BeanElement(QName qname)
Method Detail

getData

public java.lang.Object getData()
DOCUMENT ME!

Specified by:
getData in interface Element
Overrides:
getData in class AbstractElement
Returns:
the JavaBean associated with this element

setData

public void setData(java.lang.Object data)
Description copied from interface: Element
Sets the data value of this element if this element supports data binding or calls Node.setText(java.lang.String)if it doesn't

Specified by:
setData in interface Element
Overrides:
setData in class AbstractElement
Parameters:
data - DOCUMENT ME!

attribute

public Attribute attribute(java.lang.String name)
Description copied from interface: Element
Returns the attribute with the given name

Specified by:
attribute in interface Element
Overrides:
attribute in class DefaultElement
Parameters:
name - DOCUMENT ME!
Returns:
the attribute for the given local name in any namespace. If there are more than one attributes with the given local name in different namespaces then the first one is returned.

attribute

public Attribute attribute(QName qname)
Description copied from interface: Element
DOCUMENT ME!

Specified by:
attribute in interface Element
Overrides:
attribute in class DefaultElement
Parameters:
qname - is the fully qualified name
Returns:
the attribute for the given fully qualified name or null if it could not be found.

addAttribute

public Element addAttribute(java.lang.String name,
                            java.lang.String value)
Description copied from interface: Element

Adds the attribute value of the given local name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.

Specified by:
addAttribute in interface Element
Overrides:
addAttribute in class AbstractElement
Parameters:
name - is the name of the attribute whose value is to be added or updated
value - is the attribute's value
Returns:
this Element instance.

addAttribute

public Element addAttribute(QName qName,
                            java.lang.String value)
Description copied from interface: Element

Adds the attribute value of the given fully qualified name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.

Specified by:
addAttribute in interface Element
Overrides:
addAttribute in class AbstractElement
Parameters:
qName - is the fully qualified name of the attribute whose value is to be added or updated
value - is the attribute's value
Returns:
this Element instance.

setAttributes

public void setAttributes(java.util.List attributes)
Description copied from interface: Element
Sets the attributes that this element contains

Specified by:
setAttributes in interface Element
Overrides:
setAttributes in class DefaultElement
Parameters:
attributes - DOCUMENT ME!

setAttributes

public void setAttributes(org.xml.sax.Attributes attributes,
                          NamespaceStack namespaceStack,
                          boolean noNamespaceAttributes)
Description copied from class: AbstractElement
This method provides a more optimal way of setting all the attributes on an Element particularly for use in SAXReader.

Overrides:
setAttributes in class AbstractElement
Parameters:
attributes - DOCUMENT ME!
namespaceStack - DOCUMENT ME!
noNamespaceAttributes - DOCUMENT ME!

getDocumentFactory

protected DocumentFactory getDocumentFactory()
Overrides:
getDocumentFactory in class DefaultElement

getBeanAttributeList

protected BeanAttributeList getBeanAttributeList()

createAttributeList

protected java.util.List createAttributeList()
A Factory Method pattern which lazily creates a List implementation used to store content

Overrides:
createAttributeList in class AbstractElement
Returns:
DOCUMENT ME!

createAttributeList

protected java.util.List createAttributeList(int size)
Description copied from class: AbstractElement
A Factory Method pattern which creates a List implementation used to store attributes

Overrides:
createAttributeList in class AbstractElement
Parameters:
size - DOCUMENT ME!
Returns:
DOCUMENT ME!


Copyright ? 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge Logo