Package io.toro.martini
Class VelocityMethods
- java.lang.Object
-
- io.toro.martini.VelocityMethods
-
-
Constructor Summary
Constructors Constructor Description VelocityMethods(org.apache.velocity.app.VelocityEngine esbVelocityEngine)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringparse(String template)Parses a Velocity template.static Stringparse(String template, Closure<Map> params)Parses a Velocity template.static Stringparse(String template, GloopExecutionContext context)Parses a Velocity template, using all the variables available in the current Gloop context.static Stringparse(String template, GloopModel context, GloopExecutionContext gloopExecutionContext)Parses a Velocity template, using all the variables available in the current Gloop context, and provided context.static Stringparse(String template, Map<String,Object> params)Parses a Velocity template.static Stringparse(Map params, Closure<Object> template)Parses a Velocity template.
-
-
-
Constructor Detail
-
VelocityMethods
@Autowired VelocityMethods(org.apache.velocity.app.VelocityEngine esbVelocityEngine)
-
-
Method Detail
-
parse
public static String parse(@GloopParameter(allowNull=false) String template, @GloopParameter(allowNull=false) Map<String,Object> params)
Parses a Velocity template.
Example usage:
def context = [ "firstname": "James", "lastname": "Greg" ] def template = 'Hello, $firstname $lastname.' def parsedTemplate = template.parse( context ); assert parsedTemplate.equals( 'Hello, James Greg.' )
A variable called
esbis added to the context as well, which can be used to call one-liners fromGroovyMethods.- Parameters:
template- the template to parseparams- the context, which contains values which will be mapped to variables used in the template- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
parse
public static String parse(String template)
Parses a Velocity template.
Example usage:
def template = 'Hello, world.' def parsedTemplate = template.parse(); assert parsedTemplate.equals( 'Hello, world.' )
- Parameters:
template- the template to parse- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
parse
public static String parse(Map params, Closure<Object> template)
Parses a Velocity template.
Example usage:
def context = [ "firstname": "James", "lastname": "Greg" ] def template = { 'Hello, $firstname $lastname.' } def parsedTemplate = context.parse( template ); assert parsedTemplate.equals( 'Hello, James Greg.' )A variable called
esbis added to the context as well, which can be used to call one-liners fromGroovyMethods.- Parameters:
params- the context, which contains values which will be mapped to variables used in the templatetemplate- a closure returning the template to parse- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
parse
public static String parse(String template, Closure<Map> params)
Parses a Velocity template.
Example usage:
def context = [ "firstname": "James", "lastname": "Greg" ] def template = 'Hello, $firstname $lastname.' def parsedTemplate = context.parse( template ); assert parsedTemplate.equals( 'Hello, James Greg.' )
A variable called
esbis added to the context as well, which can be used to call one-liners fromGroovyMethods.- Parameters:
template- the template to parseparams- the context, which contains values which will be mapped to variables used in the template- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
parse
public static String parse(@GloopParameter(allowNull=false) String template, GloopExecutionContext context)
Parses a Velocity template, using all the variables available in the current Gloop context.
- Parameters:
template- the template to parsecontext- the Gloop execution context (automatically mapped by Gloop), from which the template context will be derived; the context contains values which will be mapped to variables used in the template- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
parse
public static String parse(@GloopParameter(allowNull=false) String template, GloopModel context, GloopExecutionContext gloopExecutionContext)
Parses a Velocity template, using all the variables available in the current Gloop context, and provided context.
- Parameters:
template- the template to parsecontext- the context, which contains values which will be mapped to variables used in the templategloopExecutionContext- the Gloop execution context (automatically mapped by Gloop), from which the template context will be derived; the context contains values which will be mapped to variables used in the template- Returns:
- evaluated Velocity template
- Since:
- 1.0
-
-