org.webmacro.engine
Class StringTemplate
java.lang.Object
|
+--org.webmacro.engine.WMTemplate
|
+--org.webmacro.engine.StringTemplate
- All Implemented Interfaces:
- Macro, Template, Visitable
- public class StringTemplate
- extends WMTemplate
StringTemplate objects read their template data from a string.
They do not need an encoding since strings are already converted
to utf by java.
- Author:
- Brian Goetz
Constructor Summary |
StringTemplate(Broker broker,
java.lang.String templateText)
Instantiate a template. |
StringTemplate(Broker broker,
java.lang.String templateText,
java.lang.String name)
Instantiate a template. |
Method Summary |
java.lang.String |
getName()
Return a name for this template. |
protected java.io.Reader |
getReader()
Get the stream the template should be read from. |
java.lang.String |
toString()
Return a name for this template. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
StringTemplate
public StringTemplate(Broker broker,
java.lang.String templateText)
- Instantiate a template. Encoding information
is not needed, as strings are already converted
to utf in java.
StringTemplate
public StringTemplate(Broker broker,
java.lang.String templateText,
java.lang.String name)
- Instantiate a template. Encoding information
is not needed, as strings are already converted
to utf in java.
- Parameters:
name
- name of string template to display in
error messages and logs
getName
public java.lang.String getName()
- Description copied from class:
WMTemplate
- Return a name for this template. If not overridden, uses toString()
- Overrides:
getName
in class WMTemplate
getReader
protected java.io.Reader getReader()
throws java.io.IOException
- Get the stream the template should be read from. Parse will
call this method in order to locate a stream.
- Overrides:
getReader
in class WMTemplate
- Following copied from class:
org.webmacro.engine.WMTemplate
- Throws:
java.io.IOException
- if unable to read template
toString
public java.lang.String toString()
- Return a name for this template. For example, if the template reads
from a file you might want to mention which it is--will be used to
produce error messages describing which template had a problem.
- Overrides:
toString
in class WMTemplate