|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.student.common.util.VelocityTemplateEngine
public class VelocityTemplateEngine
Velocity template engine.
Velocity tools supported (See http://velocity.apache.org/tools/devel/generic.html}:
Examples:$dateTool:$dateTool.get('yyyy-M-d H:m:s') -> 2003-10-19 21:54:50
$dateComparisonTool:$dateComparisonTool.difference('2005-07-04','2007-02-15').abbr -> 1 yr
$mathTool:$mathTool.toNumber($value) -> Converts java.lang.String $value to a java.lang.Number
$numberTool:$numberTool.currency($myNumber) -> $13.55
$sortTool:$sorter.sort($collection, "name:asc") -> Sorts $collection with property 'name' in ascending order
Field Summary | |
---|---|
private Map<String,Object> |
configMap
|
private org.apache.velocity.VelocityContext |
defaultContext
|
private org.apache.velocity.app.VelocityEngine |
velocityEngine
|
Constructor Summary | |
---|---|
VelocityTemplateEngine()
Constructs a velocity template engine. |
|
VelocityTemplateEngine(Map<String,Object> config)
Constructs a velocity template engine with velocity tools configurations. |
Method Summary | |
---|---|
String |
evaluate(Map<String,Object> mapContext,
Reader template)
Evaluates a template with a map of objects. |
String |
evaluate(Map<String,Object> contextMap,
String template)
Evaluates a template with a map of objects. |
private void |
init()
Initializes Velocity engine |
void |
setLogFile()
Sets the Velocity Log File to the default location. |
void |
setLogFile(String logfile)
Sets the Velocity Log File. |
void |
setLogging(boolean enableLogging)
Sets logging on or off. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final org.apache.velocity.app.VelocityEngine velocityEngine
private org.apache.velocity.VelocityContext defaultContext
private Map<String,Object> configMap
Constructor Detail |
---|
public VelocityTemplateEngine()
public VelocityTemplateEngine(Map<String,Object> config)
config
- Velocity tools configurationsMethod Detail |
---|
private void init()
public void setLogging(boolean enableLogging)
enableLogging
- True enables logging; false disables loggingpublic void setLogFile()
{catalina.base}/velocity.log
or target/velocity.log
.
public void setLogFile(String logfile)
logFile
- the path and filename for velocity loggingpublic String evaluate(Map<String,Object> contextMap, String template) throws org.apache.velocity.exception.VelocityException
contextMap
can
be null if no keys/tokens are referenced in the template
contextMap
- Map of objects to be used in the templatetemplate
- Velocity Template
org.apache.velocity.exception.VelocityException
public String evaluate(Map<String,Object> mapContext, Reader template) throws org.apache.velocity.exception.VelocityException
mapContext
- Map of Objects to be used in the templatetemplate
- Velocity Template
org.apache.velocity.exception.VelocityException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |