org.dom4j.tree

Class FlyweightEntity

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 {@link#setText} providing the entity has no text already.

Version: $Revision: 1.6 $

Author: James Strachan

Field Summary
protected Stringname
The name of the Entity
protected Stringtext
The text of the Entity
Constructor Summary
protected FlyweightEntity()
A default constructor for implementors to use.
FlyweightEntity(String name)
Creates the Entity with the specified name
FlyweightEntity(String name, String text)
Creates the Entity with the specified name and text.
Method Summary
protected NodecreateXPathResult(Element parent)
StringgetName()
DOCUMENT ME!
StringgetText()
DOCUMENT ME!
voidsetText(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.

Field Detail

name

protected String name
The name of the Entity

text

protected String text
The text of the Entity

Constructor Detail

FlyweightEntity

protected FlyweightEntity()
A default constructor for implementors to use.

FlyweightEntity

public FlyweightEntity(String name)
Creates the Entity with the specified name

Parameters: name is the name of the entity

FlyweightEntity

public FlyweightEntity(String name, String text)
Creates the Entity with the specified name and text.

Parameters: name is the name of the entity text is the text of the entity

Method Detail

createXPathResult

protected Node createXPathResult(Element parent)

getName

public String getName()
DOCUMENT ME!

Returns: the name of the entity

getText

public String getText()
DOCUMENT ME!

Returns: the text of the entity

setText

public void setText(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.

Parameters: text DOCUMENT ME!

Throws: UnsupportedOperationException DOCUMENT ME!

Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge