org.dom4j.tree
public class: FlyweightEntity [javadoc |
source]
java.lang.Object
org.dom4j.tree.AbstractNode
org.dom4j.tree.AbstractEntity
org.dom4j.tree.FlyweightEntity
All Implemented Interfaces:
Entity, Cloneable, Node, Serializable
Direct Known Subclasses:
DOMEntityReference, DefaultEntity
FlyweightEntity is a Flyweight pattern implementation of a
singly linked, read-only XML entity.
This node could be shared across documents and elements though it does not
support the parent relationship.
Often this node needs to be created and then the text content added later
(for example in SAX) so this implementation allows a call to {@link#setText}
providing the entity has no text already.
- author:
< - a href="mailto:jstrachan@apache.org">James Strachan
- version:
$ - Revision: 1.6 $
| Field Summary |
|---|
| protected String | name | The name of the Entity |
| protected String | text | The text of the Entity |
| Methods from org.dom4j.tree.AbstractNode: |
|---|
|
asXPathResult, clone, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getDocument, getDocumentFactory, getName, getNodeType, getNodeTypeName, getParent, getPath, getStringValue, getText, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write |
| Method from org.dom4j.tree.FlyweightEntity Detail: |
protected Node createXPathResult(Element parent) {
return new DefaultEntity(parent, getName(), getText());
}
|
public String getName() {
return name;
}
|
public String getText() {
return text;
}
|
public void setText(String text) {
if (this.text != null) {
this.text = text;
} else {
throw new UnsupportedOperationException(
"This Entity is read-only. " + "It cannot be modified");
}
}
sets the value of the entity if it is not defined yet otherwise an
UnsupportedOperationException is thrown as this class is
read only. |