public class TemplateUtils extends Object
For more information about the velocity template engine, use the link: Apache Velocity Project
| Modifier and Type | Class and Description |
|---|---|
static class |
TemplateUtils.TemplatePath
The class describes a path to template.
|
| Constructor and Description |
|---|
TemplateUtils() |
| Modifier and Type | Method and Description |
|---|---|
String |
construct(String pathToTemplate,
Map<String,Object> params)
It returns the string constructed from the template and its parameters.
|
String |
construct(org.apache.velocity.Template template,
Map<String,Object> params)
It returns the string constructed from the template and its parameters.
|
org.apache.velocity.Template |
createClasspathTemplate(String pathTemplate)
This method creates a template object from classpath resource.
|
org.apache.velocity.Template |
createFileTemplate(String pathTemplate)
This method creates a template object from the file system resource.
|
org.apache.velocity.Template |
createJarFileTemplate(String pathTemplate)
This method creates a template object from the file system resource.
|
org.apache.velocity.Template |
createTemplate(String pathToTemplate)
This method creates a template object by using a path to the template.
|
TemplateUtils.TemplatePath |
normalizeTemplatePath(String source)
This method normalizes a template path.
|
public String construct(String pathToTemplate, Map<String,Object> params) throws TemplateCreationException
pathToTemplate - the path to a templateparams - parameters of a templateTemplateCreationException - this exception will occur if the path to the template isn't validpublic String construct(org.apache.velocity.Template template, Map<String,Object> params)
template - the object template (see also Template)params - parameters of a templatepublic org.apache.velocity.Template createTemplate(String pathToTemplate) throws TemplateCreationException
pathToTemplate - a path to the template. This parameter must start with one
of these substrings: 'file://', 'classpath:', 'jar:file:'.Template)TemplateCreationException - this exception will occur if the path to the template isn't validpublic org.apache.velocity.Template createClasspathTemplate(String pathTemplate)
pathTemplate - a path to the classpath resourceTemplate)public org.apache.velocity.Template createFileTemplate(String pathTemplate)
pathTemplate - a path to the file system resourceTemplate)public org.apache.velocity.Template createJarFileTemplate(String pathTemplate)
pathTemplate - a path to the file system resourceTemplate)public TemplateUtils.TemplatePath normalizeTemplatePath(String source)
Prefixes are supported: 'file:///', 'classpath:', 'jar:file:'
source - a path to the resourceTemplateUtils.TemplatePathInvalidPathException - if the parameter 'source' has incorrect valueCopyright © 2023. All rights reserved.