|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttemmental.Template
public class Template
Read and manipulate a template file to write data on an output stream.
Many constructors are available:
Constructor Summary | |
---|---|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.util.Locale locale,
java.lang.Object... resourcesContainers)
|
|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.util.Properties properties)
Create a template with the given parameters. |
|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.util.Properties properties,
java.util.Locale locale)
Create a template with the given parameters. |
|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.util.ResourceBundle bundle)
Create a template with the given parameters. |
|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.lang.String resourcePath)
Create a template with the given parameters. |
|
Template(java.lang.String filepath,
java.util.Map<java.lang.String,? extends ObjectFilter> filters,
java.lang.String resourcePath,
java.util.Locale locale)
Create a template with the given parameters. |
Method Summary | |
---|---|
TemplateMessages |
getMessages()
|
boolean |
hasSection(java.lang.String sectionName)
Tests if the given section exists in the template |
void |
printFile(java.io.Writer out)
Prints the whole file on the stream. |
void |
printFile(java.io.Writer out,
java.util.Map<java.lang.String,? extends java.lang.Object> model)
Prints the whole file on the stream. |
void |
printSection(java.io.Writer out,
java.lang.String sectionName)
Prints a section of the file on the stream. |
void |
printSection(java.io.Writer out,
java.lang.String sectionName,
java.util.Map<java.lang.String,? extends java.lang.Object> model)
Prints a section of the file on the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.util.Properties properties) throws java.io.IOException, TemplateException
filepath
- the path to the template file to parsefilters
- the map of filtersproperties
- the messages
java.io.IOException
- if an I/O error occurs when reading the template file
TemplateException
- if an other error occurs when reading the template filepublic Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.util.Locale locale, java.lang.Object... resourcesContainers) throws java.io.IOException, TemplateException
java.io.IOException
TemplateException
public Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.util.Properties properties, java.util.Locale locale) throws java.io.IOException, TemplateException
filepath
- the path to the template file to parsefilters
- the map of filtersproperties
- the messageslocale
- locale to use to format messages (date, numbers...)
java.io.IOException
- if an I/O error occurs when reading the template file
TemplateException
- if an other error occurs when reading the template filepublic Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.util.ResourceBundle bundle) throws java.io.IOException, TemplateException
filepath
- the path to the template file to parsefilters
- the map of filtersbundle
- the messages
java.io.IOException
- if an I/O error occurs when reading the template file
TemplateException
- if an other error occurs when reading the template filepublic Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.lang.String resourcePath) throws java.io.IOException, TemplateException
filepath
- the path to the template file to parsefilters
- the map of filtersresourcePath
- the messages (classpath:path.to.my.file
or file:/path/to/my/file.properties
)
java.io.IOException
- if an I/O error occurs when reading the template file
TemplateException
- if an other error occurs when reading the template filepublic Template(java.lang.String filepath, java.util.Map<java.lang.String,? extends ObjectFilter> filters, java.lang.String resourcePath, java.util.Locale locale) throws java.io.IOException, TemplateException
filepath
- the path to the template file to parsefilters
- the map of filtersresourcePath
- the messages (classpath:path.to.my.file
or file:/path/to/my/file.properties
)locale
- locale to retrieve localized messages and format messages (date, numbers...)
java.io.IOException
- if an I/O error occurs when reading the template file
TemplateException
- if an other error occurs when reading the template fileMethod Detail |
---|
public boolean hasSection(java.lang.String sectionName)
sectionName
- the possible section name
true
if the section exists, false
otherwise.public void printFile(java.io.Writer out) throws TemplateException, java.io.IOException
out
- the stream
TemplateException
- if an error is detected by the template engine
java.io.IOException
- if an I/O error occurspublic void printFile(java.io.Writer out, java.util.Map<java.lang.String,? extends java.lang.Object> model) throws TemplateException, java.io.IOException
out
- the streammodel
- the model
TemplateException
- if an error is detected by the template engine
java.io.IOException
- if an I/O error occurspublic void printSection(java.io.Writer out, java.lang.String sectionName, java.util.Map<java.lang.String,? extends java.lang.Object> model) throws TemplateException, java.io.IOException
out
- the streamsectionName
- the section to displaymodel
- the model
TemplateException
- if an error is detected by the template engine
java.io.IOException
- if an I/O error occurspublic void printSection(java.io.Writer out, java.lang.String sectionName) throws TemplateException, java.io.IOException
out
- the streamsectionName
- the section to display
TemplateException
- if an error is detected by the template engine
java.io.IOException
- if an I/O error occurspublic TemplateMessages getMessages()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |