Class FlyweightEntity
java.lang.Object
org.dom4j.tree.AbstractNode
org.dom4j.tree.AbstractEntity
org.dom4j.tree.FlyweightEntity
- All Implemented Interfaces:
Serializable, Cloneable, Entity, Node
- Direct Known Subclasses:
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 setText(String)
providing the entity has no text already.
- Version:
- $Revision: 1.6 $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe name of theEntityprotected StringThe text of theEntityFields inherited from class AbstractNode
NODE_TYPE_NAMESFields inherited from interface 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
ConstructorsModifierConstructorDescriptionprotectedA default constructor for implementors to use.FlyweightEntity(String name) Creates theEntitywith the specified nameFlyweightEntity(String name, String text) Creates theEntitywith the specified name and text. -
Method Summary
Modifier and TypeMethodDescriptionprotected NodecreateXPathResult(Element parent) getName()DOCUMENT ME!getText()DOCUMENT ME!voidsets the value of the entity if it is not defined yet otherwise anUnsupportedOperationExceptionis thrown as this class is read only.Methods inherited from class AbstractEntity
accept, asXML, getNodeType, getPath, getStringValue, getUniquePath, toString, writeMethods inherited from class AbstractNode
asXPathResult, clone, createPattern, createXPath, createXPathFilter, detach, getDocument, getDocumentFactory, getNodeTypeName, getParent, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, supportsParent, valueOfMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Node
asXPathResult, clone, createXPath, detach, getDocument, getNodeTypeName, getParent, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, supportsParent, valueOf
-
Field Details
-
name
The name of theEntity -
text
The text of theEntity
-
-
Constructor Details
-
FlyweightEntity
protected FlyweightEntity()A default constructor for implementors to use. -
FlyweightEntity
Creates theEntitywith the specified name- Parameters:
name- is the name of the entity
-
FlyweightEntity
-
-
Method Details
-
getName
DOCUMENT ME!- Specified by:
getNamein interfaceNode- Overrides:
getNamein classAbstractNode- Returns:
- the name of the entity
-
getText
DOCUMENT ME!- Specified by:
getTextin interfaceNode- Overrides:
getTextin classAbstractNode- Returns:
- the text of the entity
-
setText
sets the value of the entity if it is not defined yet otherwise anUnsupportedOperationExceptionis thrown as this class is read only.- Specified by:
setTextin interfaceNode- Overrides:
setTextin classAbstractNode- Parameters:
text- DOCUMENT ME!- Throws:
UnsupportedOperationException- DOCUMENT ME!
-
createXPathResult
- Overrides:
createXPathResultin classAbstractNode
-