Package org.apache.velocity.script
Class VelocityScriptEngineFactory
- java.lang.Object
-
- org.apache.velocity.script.VelocityScriptEngineFactory
-
- All Implemented Interfaces:
ScriptEngineFactory
public class VelocityScriptEngineFactory extends Object implements ScriptEngineFactory
-
-
Constructor Summary
Constructors Constructor Description VelocityScriptEngineFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEngineName()
get engine nameString
getEngineVersion()
get engine versionList<String>
getExtensions()
get the list of file extensions handled by Velocity: vm, vtl, vhtmlString
getLanguageName()
get language nameString
getLanguageVersion()
get language version (same as engine version)String
getMethodCallSyntax(String obj, String m, String... args)
get Velocity syntax for calling method 'm' on object 'obj' with provided argumentsList<String>
getMimeTypes()
get the list of Velocity mime typesList<String>
getNames()
get the list of namesString
getOutputStatement(String toDisplay)
get VTL expression used to display specified stringString
getParameter(String key)
get engine parameter for provided keyString
getProgram(String... statements)
get whole VTL program given VTL linesScriptEngine
getScriptEngine()
get a Velocity script engine
-
-
-
Method Detail
-
getEngineName
public String getEngineName()
get engine name- Specified by:
getEngineName
in interfaceScriptEngineFactory
- Returns:
- engine name, aka "Velocity"
-
getEngineVersion
public String getEngineVersion()
get engine version- Specified by:
getEngineVersion
in interfaceScriptEngineFactory
- Returns:
- engine version string
-
getExtensions
public List<String> getExtensions()
get the list of file extensions handled by Velocity: vm, vtl, vhtml- Specified by:
getExtensions
in interfaceScriptEngineFactory
- Returns:
- extensions list
-
getLanguageName
public String getLanguageName()
get language name- Specified by:
getLanguageName
in interfaceScriptEngineFactory
- Returns:
- language name, aka "VTL"
-
getLanguageVersion
public String getLanguageVersion()
get language version (same as engine version)- Specified by:
getLanguageVersion
in interfaceScriptEngineFactory
- Returns:
- language version string
-
getMethodCallSyntax
public String getMethodCallSyntax(String obj, String m, String... args)
get Velocity syntax for calling method 'm' on object 'obj' with provided arguments- Specified by:
getMethodCallSyntax
in interfaceScriptEngineFactory
- Parameters:
obj
-m
-args
-- Returns:
- VTL call ${obj.m(args...)}
-
getMimeTypes
public List<String> getMimeTypes()
get the list of Velocity mime types- Specified by:
getMimeTypes
in interfaceScriptEngineFactory
- Returns:
- singleton { 'text/x-velocity' }
-
getNames
public List<String> getNames()
get the list of names- Specified by:
getNames
in interfaceScriptEngineFactory
- Returns:
- { 'velocity', 'Velocity' }
-
getOutputStatement
public String getOutputStatement(String toDisplay)
get VTL expression used to display specified string- Specified by:
getOutputStatement
in interfaceScriptEngineFactory
- Parameters:
toDisplay
-- Returns:
- escaped string #[[toDisplay]]#
-
getParameter
public String getParameter(String key)
get engine parameter for provided key- Specified by:
getParameter
in interfaceScriptEngineFactory
- Parameters:
key
-- Returns:
- found parameter, or null
-
getProgram
public String getProgram(String... statements)
get whole VTL program given VTL lines- Specified by:
getProgram
in interfaceScriptEngineFactory
- Parameters:
statements
- VTL lines- Returns:
- lines concatenated with carriage returns
-
getScriptEngine
public ScriptEngine getScriptEngine()
get a Velocity script engine- Specified by:
getScriptEngine
in interfaceScriptEngineFactory
- Returns:
- a new Velocity script engine
-
-