Top Description Fields Constructors Methods
org.dom4j.tree

public Class DefaultEntity

extends FlyweightEntity
Class Inheritance
Known Direct Subclasses
org.dom4j.dom.DOMEntityReference
Imports
org.dom4j.Element

DefaultEntity is the default Entity implementation. It is a doubly linked node which supports the parent relationship and can be modified in place.

Author
James Strachan
Version
$Revision: 1.11 $

Field Summary

Modifier and TypeField and Description
private Element
parent

The parent of this node

Inherited from org.dom4j.tree.FlyweightEntity:
nametext

Constructor Summary

AccessConstructor and Description
public
DefaultEntity(String
is the name of the entity
name
)

Creates the Entity with the specified name

public
DefaultEntity(String
is the name of the entity
name
,
String
is the text of the entity
text
)

Creates the Entity with the specified name and text.

public
DefaultEntity(Element
is the parent element
parent
,
String
is the name of the entity
name
,
String
is the text of the entity
text
)

Creates the Entity with the specified name and text.

Method Summary

Modifier and TypeMethod and Description
public Element
getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

public boolean
isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified.

public void
setName(String
is the new name of this node
name
)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

public void
setParent(Element
is the new parent of this node.
parent
)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public void
setText(String
DOCUMENT ME!
text
)

Overrides org.dom4j.tree.FlyweightEntity.setText.

Implements org.dom4j.Node.setText.

sets the value of the entity if it is not defined yet otherwise an UnsupportedOperationException is thrown as this class is read only.
public boolean
supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Inherited from org.dom4j.tree.FlyweightEntity:
createXPathResultgetNamegetText

Field Detail

parentback to summary
private Element parent

The parent of this node

Constructor Detail

DefaultEntityback to summary
public DefaultEntity(String name)

Creates the Entity with the specified name

Parameters
name:String

is the name of the entity

DefaultEntityback to summary
public DefaultEntity(String name, String text)

Creates the Entity with the specified name and text.

Parameters
name:String

is the name of the entity

text:String

is the text of the entity

DefaultEntityback to summary
public DefaultEntity(Element parent, String name, String text)

Creates the Entity with the specified name and text.

Parameters
parent:Element

is the parent element

name:String

is the name of the entity

text:String

is the text of the entity

Method Detail

getParentback to summary
public Element getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

Doc from org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Element

the parent of this node or null if it is the root of the tree or the parent relationship is not supported.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

Doc from org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified. Any attempt to modify a read-only Node will result in an UnsupportedOperationException being thrown.

Returns:boolean

true if this Node is read only and cannot be modified otherwise false.

setNameback to summary
public void setName(String name)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

Doc from org.dom4j.Node.setName.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
name:String

is the new name of this node

setParentback to summary
public void setParent(Element parent)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

Doc from org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside an Element implementation method and is not intended for general use.

Parameters
parent:Element

is the new parent of this node.

setTextback to summary
public void setText(String text)

Overrides org.dom4j.tree.FlyweightEntity.setText.

Implements org.dom4j.Node.setText.

Doc from org.dom4j.tree.FlyweightEntity.setText.

sets the value of the entity if it is not defined yet otherwise an UnsupportedOperationException is thrown as this class is read only.

Parameters
text:String

DOCUMENT ME!

supportsParentback to summary
public boolean supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

Doc from org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

Returns:boolean

true if this node supports the parent relationship or false it is not supported