uk.co.weft.domutil
Class CommentGenerator
java.lang.Object
uk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.domutil.NodeGeneratorImpl
uk.co.weft.domutil.CommentGenerator
- All Implemented Interfaces:
- NodeGenerator, ResourceConsumer
- public class CommentGenerator
- extends NodeGeneratorImpl
A generator which generates a comment, using as content either the value of
my token in the generate-time context, or, if there is none, then just my
token.
|
Field Summary |
protected java.lang.String |
token
The token whose value in the generate time context will be the content
of the section I generate. |
|
Constructor Summary |
CommentGenerator(java.lang.String token)
Creates a new CDataSectionGenerator object. |
|
Method Summary |
Node |
generate(Document doc,
Context c)
generates a comment, using as content either the value of my token in
the generate-time context, or, if there is none, then just my token. |
java.lang.String |
getName()
get my name |
void |
init(Context config)
required by NodeGenerator interface but in practice not needed here. |
void |
setDebug(boolean debug)
required by NodeGenerator interface but in practice not needed here. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
token
protected java.lang.String token
- The token whose value in the generate time context will be the content
of the section I generate.
CommentGenerator
public CommentGenerator(java.lang.String token)
- Creates a new CDataSectionGenerator object.
- Parameters:
token - a token whose value in the generate time context will be
the content of the section I generate.
setDebug
public void setDebug(boolean debug)
- required by NodeGenerator interface but in practice not needed here.
- Specified by:
setDebug in interface NodeGenerator- Overrides:
setDebug in class NodeGeneratorImpl
- Parameters:
debug - whether or not to set debugging mode
getName
public java.lang.String getName()
- Description copied from class:
NodeGeneratorImpl
- get my name
- Specified by:
getName in interface NodeGenerator- Overrides:
getName in class NodeGeneratorImpl
- Returns:
- the token I use to collect my content from the context
generate
public Node generate(Document doc,
Context c)
throws GenerationException,
DOMException
- generates a comment, using as content either the value of my token in
the generate-time context, or, if there is none, then just my token.
- Specified by:
generate in interface NodeGenerator- Specified by:
generate in class NodeGeneratorImpl
- Parameters:
doc - the document in which this element is to be created.c - the context in which this generation takes place
- Returns:
- the element created.
- Throws:
GenerationException - may throw a GenerationException if the
generation cannot be completed.
DOMException
init
public void init(Context config)
throws InitialisationException
- required by NodeGenerator interface but in practice not needed here.
- Specified by:
init in interface NodeGenerator- Specified by:
init in class NodeGeneratorImpl
- Parameters:
config - a context containing configuration information.
- Throws:
InitialisationException