Top Description Fields Constructors Methods
org.dom4j.bean

public Class BeanElement

extends DefaultElement
Class Inheritance
Imports
java.util.List, org.dom4j.Attribute, .DocumentFactory, .Element, .Namespace, .QName, org.dom4j.tree.DefaultElement, .NamespaceStack, org.xml.sax.Attributes

BeanElement uses a Java Bean to store its attributes.

Author
James Strachan
Version
$Revision: 1.15 $

Field Summary

Modifier and TypeField and Description
private Object
bean

The JavaBean which defines my attributes

private static final DocumentFactory
DOCUMENT_FACTORY

Hides org.dom4j.tree.DefaultElement.DOCUMENT_FACTORY.

The DocumentFactory instance used by default

Constructor Summary

AccessConstructor and Description
public
public
BeanElement(String name, Namespace namespace, Object bean)

public
BeanElement(QName qname, Object bean)

public

Method Summary

Modifier and TypeMethod and Description
public Element
addAttribute(String
is the name of the attribute whose value is to be added or updated
name
,
String
is the attribute's value
value
)

Overrides org.dom4j.tree.AbstractElement.addAttribute.

Implements org.dom4j.Element.addAttribute.

Adds the attribute value of the given local name.
public Element
addAttribute(QName
is the fully qualified name of the attribute whose value is to be added or updated
qName
,
String
is the attribute's value
value
)

Overrides org.dom4j.tree.AbstractElement.addAttribute.

Implements org.dom4j.Element.addAttribute.

Adds the attribute value of the given fully qualified name.
public BeanAttribute
attribute(String
DOCUMENT ME!
name
)

Overrides org.dom4j.tree.DefaultElement.attribute.

Implements org.dom4j.Element.attribute.

Returns the attribute with the given name
public BeanAttribute
attribute(QName
is the fully qualified name
qname
)

Overrides org.dom4j.tree.DefaultElement.attribute.

Implements org.dom4j.Element.attribute.

DOCUMENT ME!
protected List<Attribute>

Returns:

DOCUMENT ME!
createAttributeList
()

Overrides org.dom4j.tree.AbstractElement.createAttributeList.

A Factory Method pattern which lazily creates a List implementation used to store content
protected List<Attribute>
createAttributeList(int
DOCUMENT ME!
size
)

Overrides org.dom4j.tree.AbstractElement.createAttributeList.

A Factory Method pattern which creates a List implementation used to store attributes
protected BeanAttributeList
public Object

Returns:

the JavaBean associated with this element
getData
()

Overrides org.dom4j.tree.AbstractElement.getData.

Implements org.dom4j.Element.getData.

DOCUMENT ME!
protected DocumentFactory
public void
setAttributes(List<Attribute>
DOCUMENT ME!
attributes
)

Overrides org.dom4j.tree.DefaultElement.setAttributes.

Implements org.dom4j.Element.setAttributes.

Sets the attributes that this element contains
public void
setAttributes(Attributes
DOCUMENT ME!
attributes
,
NamespaceStack
DOCUMENT ME!
namespaceStack
,
boolean
DOCUMENT ME!
noNamespaceAttributes
)

Overrides org.dom4j.tree.AbstractElement.setAttributes.

This method provides a more optimal way of setting all the attributes on an Element particularly for use in org.dom4j.io.SAXReader.
public void
setData(Object
DOCUMENT ME!
data
)

Overrides org.dom4j.tree.AbstractElement.setData.

Implements org.dom4j.Element.setData.

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't
Inherited from org.dom4j.tree.DefaultElement:
addadditionalNamespacesadditionalNamespacesaddNewNodeattributeattributeattributeCountattributeIteratorattributeListattributeListattributesclearContentclonecontentListdeclaredNamespaceselementelementelementgetDocumentgetNamespaceForPrefixgetNamespaceForURIgetParentgetQNamegetStringValuegetTextindexOfnodenodeCountnodeIteratorprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveNoderemoveProcessingInstructionsetAttributeListsetContentsetDocumentsetParentsetQNamesupportsParent

Field Detail

beanback to summary
private Object bean

The JavaBean which defines my attributes

DOCUMENT_FACTORYback to summary
private static final DocumentFactory DOCUMENT_FACTORY

Hides org.dom4j.tree.DefaultElement.DOCUMENT_FACTORY.

The DocumentFactory instance used by default

Constructor Detail

BeanElementback to summary
public BeanElement(String name, Object bean)
BeanElementback to summary
public BeanElement(String name, Namespace namespace, Object bean)
BeanElementback to summary
public BeanElement(QName qname, Object bean)
BeanElementback to summary
public BeanElement(QName qname)

Method Detail

addAttributeback to summary
public Element addAttribute(String name, String value)

Overrides org.dom4j.tree.AbstractElement.addAttribute.

Implements org.dom4j.Element.addAttribute.

Doc from org.dom4j.Element.addAttribute.

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.

Parameters
name:String

is the name of the attribute whose value is to be added or updated

value:String

is the attribute's value

Returns:Element

this Element instance.

addAttributeback to summary
public Element addAttribute(QName qName, String value)

Overrides org.dom4j.tree.AbstractElement.addAttribute.

Implements org.dom4j.Element.addAttribute.

Doc from org.dom4j.Element.addAttribute.

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.

Parameters
qName:QName

is the fully qualified name of the attribute whose value is to be added or updated

value:String

is the attribute's value

Returns:Element

this Element instance.

attributeback to summary
public BeanAttribute attribute(String name)

Overrides org.dom4j.tree.DefaultElement.attribute.

Implements org.dom4j.Element.attribute.

Doc from org.dom4j.Element.attribute.

Returns the attribute with the given name

Parameters
name:String

DOCUMENT ME!

Returns:BeanAttribute

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.

attributeback to summary
public BeanAttribute attribute(QName qname)

Overrides org.dom4j.tree.DefaultElement.attribute.

Implements org.dom4j.Element.attribute.

Doc from org.dom4j.Element.attribute.

DOCUMENT ME!

Parameters
qname:QName

is the fully qualified name

Returns:BeanAttribute

the attribute for the given fully qualified name or null if it could not be found.

createAttributeListback to summary
protected List<Attribute> createAttributeList()

Overrides org.dom4j.tree.AbstractElement.createAttributeList.

A Factory Method pattern which lazily creates a List implementation used to store content

Returns:List<Attribute>

DOCUMENT ME!

createAttributeListback to summary
protected List<Attribute> createAttributeList(int size)

Overrides org.dom4j.tree.AbstractElement.createAttributeList.

Doc from org.dom4j.tree.AbstractElement.createAttributeList.

A Factory Method pattern which creates a List implementation used to store attributes

Parameters
size:int

DOCUMENT ME!

Returns:List<Attribute>

DOCUMENT ME!

getBeanAttributeListback to summary
protected BeanAttributeList getBeanAttributeList()
getDataback to summary
public Object getData()

Overrides org.dom4j.tree.AbstractElement.getData.

Implements org.dom4j.Element.getData.

DOCUMENT ME!

Returns:Object

the JavaBean associated with this element

getDocumentFactoryback to summary
protected DocumentFactory getDocumentFactory()

Overrides org.dom4j.tree.DefaultElement.getDocumentFactory.

setAttributesback to summary
public void setAttributes(List<Attribute> attributes)

Overrides org.dom4j.tree.DefaultElement.setAttributes.

Implements org.dom4j.Element.setAttributes.

Doc from org.dom4j.Element.setAttributes.

Sets the attributes that this element contains

Parameters
attributes:List<Attribute>

DOCUMENT ME!

setAttributesback to summary
public void setAttributes(Attributes attributes, NamespaceStack namespaceStack, boolean noNamespaceAttributes)

Overrides org.dom4j.tree.AbstractElement.setAttributes.

Doc from org.dom4j.tree.AbstractElement.setAttributes.

This method provides a more optimal way of setting all the attributes on an Element particularly for use in org.dom4j.io.SAXReader.

Parameters
attributes:Attributes

DOCUMENT ME!

namespaceStack:NamespaceStack

DOCUMENT ME!

noNamespaceAttributes:boolean

DOCUMENT ME!

setDataback to summary
public void setData(Object data)

Overrides org.dom4j.tree.AbstractElement.setData.

Implements org.dom4j.Element.setData.

Doc from org.dom4j.Element.setData.

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't

Parameters
data:Object

DOCUMENT ME!