public class FlyweightEntity extends AbstractEntity
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(java.lang.String)
providing the entity has no text already.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name
The name of the
Entity |
protected java.lang.String |
text
The text of the
Entity |
NODE_TYPE_NAMES
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
Modifier | Constructor and Description |
---|---|
protected |
FlyweightEntity()
A default constructor for implementors to use.
|
|
FlyweightEntity(java.lang.String name)
Creates the
Entity with the specified name |
|
FlyweightEntity(java.lang.String name,
java.lang.String text)
Creates the
Entity with the specified name and text. |
Modifier and Type | Method and Description |
---|---|
protected Node |
createXPathResult(Element parent) |
java.lang.String |
getName()
DOCUMENT ME!
|
java.lang.String |
getText()
DOCUMENT ME!
|
void |
setText(java.lang.String text)
sets the value of the entity if it is not defined yet otherwise an
UnsupportedOperationException is thrown as this class is
read only. |
accept, asXML, getNodeType, getPath, getStringValue, getUniquePath, toString, write
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, valueOf
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asXPathResult, clone, createXPath, detach, getDocument, getNodeTypeName, getParent, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, supportsParent, valueOf
protected java.lang.String name
Entity
protected java.lang.String text
Entity
protected FlyweightEntity()
public FlyweightEntity(java.lang.String name)
Entity
with the specified namename
- is the name of the entitypublic FlyweightEntity(java.lang.String name, java.lang.String text)
Entity
with the specified name and text.name
- is the name of the entitytext
- is the text of the entitypublic java.lang.String getName()
getName
in interface Node
getName
in class AbstractNode
public java.lang.String getText()
getText
in interface Node
getText
in class AbstractNode
public void setText(java.lang.String text)
UnsupportedOperationException
is thrown as this class is
read only.setText
in interface Node
setText
in class AbstractNode
text
- DOCUMENT ME!java.lang.UnsupportedOperationException
- DOCUMENT ME!protected Node createXPathResult(Element parent)
createXPathResult
in class AbstractNode