|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jstags.utils.template.TemplateUtils
public class TemplateUtils
This class contains a set of methods to work with templates.
Every tag included in the library will generate a chunk of JavaScript code. Such code is generated by means of templates.
A template is just a text file that contains a collection of %VAR_NAME%
elements representing variables to be replaced with the data used in every tag
instance. Every time a tag is created, the JavaScript piece of code neeeded will be
created. First of all, the template associated with the tag created will be retrieve.
After that, the values of every %VAR_NAME%
in that template will
be replaced with the ones set in the tag. The code generated will contain the
necessary logic to insert in the page
Field Summary | |
---|---|
private static org.apache.log4j.Logger |
logger
Logger for this class |
Constructor Summary | |
---|---|
TemplateUtils()
|
Method Summary | |
---|---|
static java.lang.String |
getTemplateAsString(java.lang.String templateFileName)
Locates templateFileName in TemplateConstants.TEMPLATES_FOLDER
and returns its content |
static java.lang.String |
replaceValuesInTemplate(java.lang.String template,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
Given a template content, it replaces the variables in it returning the new content |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.log4j.Logger logger
Constructor Detail |
---|
public TemplateUtils()
Method Detail |
---|
public static java.lang.String getTemplateAsString(java.lang.String templateFileName) throws TemplateException
templateFileName
in TemplateConstants.TEMPLATES_FOLDER
and returns its content
templateFileName
- name of the template to be retrieved
String
with the templateFileName contents
TemplateException
public static java.lang.String replaceValuesInTemplate(java.lang.String template, java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
template
- content to be used as a templatenameValuePairs
- Map
of (String
, String
) pairs representing
the data to be replaced in the template. Every Map.Entry
represents a variable name
and its value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |