public class SimpleTemplater
extends java.lang.Object
Constructor and Description |
---|
SimpleTemplater(boolean templateIsHTML)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
buildOutputUsingInputStreamTemplate(java.io.InputStream templateIS,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Returns the template with all fields replaced by their values
|
java.lang.String |
buildOutputUsingResourceTemplate(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Returns the template with all fields replaced by their values
|
java.lang.String |
buildOutputUsingStringTemplate(java.lang.String template,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Returns the template with all fields replaced by their values
|
static SimpleTemplater |
getInstance()
Returns an instance of SimpleTemplater which will not deal with HTML
|
static SimpleTemplater |
getInstance(boolean templateIsHTML)
Returns an instance of SimpleTemplater which will or will not deal with HTML
|
static java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> |
getSequence(java.lang.String indexName,
int from,
int to)
Returns a sequence of numbers going from 'from' to 'to', using indexName as key in the map
this sequence can then be added to a Map
|
boolean |
templateNameIsHTML(java.lang.String templateName) |
public SimpleTemplater(boolean templateIsHTML)
templateIsHTML
- - set to true if the template that will be fed is HTMLpublic static SimpleTemplater getInstance()
public static SimpleTemplater getInstance(boolean templateIsHTML)
templateIsHTML
- - set to true if the template that will be fed is HTMLpublic static java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getSequence(java.lang.String indexName, int from, int to)
indexName
- - the name of the parameterfrom
- - start of the sequenceto
- - end of the sequencepublic java.lang.String buildOutputUsingResourceTemplate(java.lang.String templateName, java.util.Map<java.lang.String,java.lang.Object> parameters)
templateName
- - the name of the template to be found in the code archiveparameters
- - MapSimpleTemplaterException
- - in case of an error in the template or in the passed parameterspublic java.lang.String buildOutputUsingInputStreamTemplate(java.io.InputStream templateIS, java.util.Map<java.lang.String,java.lang.Object> parameters)
templateIS
- - an InputStreamparameters
- - MapSimpleTemplaterException
- - in case of an error in the template or in the passed parameterspublic java.lang.String buildOutputUsingStringTemplate(java.lang.String template, java.util.Map<java.lang.String,java.lang.Object> parameters)
template
- - a String containing the templateparameters
- - MapSimpleTemplaterException
- - in case of an error in the template or in the passed parameterspublic boolean templateNameIsHTML(java.lang.String templateName)