public class VelocityUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
VELOCITY_TEMPLATE_FILE_EXTENSION
The Constant VELOCITY_TEMPLATE_FILE_EXTENSION.
|
| Constructor and Description |
|---|
VelocityUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.velocity.app.VelocityEngine |
getClasspathResourceLoaderVelocityEngine()
Gets the velocity engine that load resources from the class path.
|
static org.apache.velocity.Template |
getTemplate(String templateAsString)
Gets a velocity template from the given String.
|
static org.apache.velocity.Template |
getTemplate(org.apache.velocity.app.VelocityEngine ve,
String path,
String templateName)
Gets the velocity template with default encoding "UTF-8".
|
static org.apache.velocity.Template |
getTemplate(org.apache.velocity.app.VelocityEngine ve,
String path,
String templateName,
String encoding)
Gets the velocity template.
|
static String |
merge(org.apache.velocity.VelocityContext context,
String templateAsString)
Merges the given context with the given template that is a String object and returns the
result.
|
static String |
merge(org.apache.velocity.VelocityContext context,
String logTag,
String templateAsString)
Merges the given context with the given template that is a String object and returns the
result.
|
public static final String VELOCITY_TEMPLATE_FILE_EXTENSION
public static org.apache.velocity.app.VelocityEngine getClasspathResourceLoaderVelocityEngine()
public static org.apache.velocity.Template getTemplate(String templateAsString) throws org.apache.velocity.runtime.parser.ParseException
templateAsString - the template as stringorg.apache.velocity.runtime.parser.ParseException - the parse exceptionpublic static org.apache.velocity.Template getTemplate(org.apache.velocity.app.VelocityEngine ve,
String path,
String templateName)
ve - the vepath - the pathtemplateName - the template namepublic static org.apache.velocity.Template getTemplate(org.apache.velocity.app.VelocityEngine ve,
String path,
String templateName,
String encoding)
ve - the vepath - the pathtemplateName - the template nameencoding - the encodingpublic static String merge(org.apache.velocity.VelocityContext context, String templateAsString)
context - the contexttemplateAsString - the template as stringpublic static String merge(org.apache.velocity.VelocityContext context, String logTag, String templateAsString)
context - the contextlogTag - to be used as the template name for log messagestemplateAsString - the template as stringCopyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.