org.webmacro.engine
Class FileTemplate
java.lang.Object
|
+--org.webmacro.engine.WMTemplate
|
+--org.webmacro.engine.FileTemplate
- All Implemented Interfaces:
- Macro, Template, Visitable
- public class FileTemplate
- extends WMTemplate
FileTemplate objects read their template data from a text file.
Constructor Summary |
FileTemplate(Broker broker,
java.io.File templateFile)
Instantiate a template based on the specified file using
the default encoding from WebMacro.properties (TemplateEncoding),
if not specified there then the UTF-8 encoding. |
FileTemplate(Broker broker,
java.io.File tmplFile,
java.lang.String encoding)
Instantiate a template based on the specified file using
the specified encoding to read the template. |
FileTemplate(Broker broker,
java.lang.String filename)
Instantiate a template based on the specified filename using
the default encoding from WebMacro.properties (TemplateEncoding),
or if not specified there then the UTF-8 encoding. |
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 |
FileTemplate
public FileTemplate(Broker broker,
java.lang.String filename)
- Instantiate a template based on the specified filename using
the default encoding from WebMacro.properties (TemplateEncoding),
or if not specified there then the UTF-8 encoding.
FileTemplate
public FileTemplate(Broker broker,
java.io.File templateFile)
- Instantiate a template based on the specified file using
the default encoding from WebMacro.properties (TemplateEncoding),
if not specified there then the UTF-8 encoding.
FileTemplate
public FileTemplate(Broker broker,
java.io.File tmplFile,
java.lang.String encoding)
- Instantiate a template based on the specified file using
the specified encoding to read the template.
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
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