Package com.avoka.core.util
Class StringTemplate
- java.lang.Object
-
- com.avoka.core.util.StringTemplate
-
public class StringTemplate extends Object
Provides a StringTemplate which utilizes the Velocity Engine.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_TEMPLATE_PROPS
-
Constructor Summary
Constructors Constructor Description StringTemplate(String content)
Create a template with the given content.StringTemplate(String content, ServletContext servletContext)
Create a template with the given content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.velocity.app.VelocityEngine
getTemplateEngine()
String
merge(String key, Object value)
Merge the given model key name and value with the template.String
merge(Map model)
Merge the given model data with the template.
-
-
-
Field Detail
-
DEFAULT_TEMPLATE_PROPS
protected static final String DEFAULT_TEMPLATE_PROPS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringTemplate
public StringTemplate(String content)
Create a template with the given content.- Parameters:
content
- the template content
-
StringTemplate
public StringTemplate(String content, ServletContext servletContext)
Create a template with the given content.- Parameters:
content
- the template contentservletContext
- the applications servlet context
-
-
Method Detail
-
merge
public String merge(Map model)
Merge the given model data with the template.- Parameters:
model
- the model data to merge- Returns:
- the rendered template merged with the model
-
merge
public String merge(String key, Object value)
Merge the given model key name and value with the template.- Parameters:
key
- the model key namevalue
- the model value- Returns:
- the rendered template merged with the model
-
getTemplateEngine
protected org.apache.velocity.app.VelocityEngine getTemplateEngine()
-
-