Package org.apache.velocity.script
Class VelocityScriptEngineFactory
java.lang.Object
org.apache.velocity.script.VelocityScriptEngineFactory
- All Implemented Interfaces:
ScriptEngineFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget engine nameget engine versionget the list of file extensions handled by Velocity: vm, vtl, vhtmlget language nameget language version (same as engine version)getMethodCallSyntax
(String obj, String m, String... args) get Velocity syntax for calling method 'm' on object 'obj' with provided argumentsget the list of Velocity mime typesgetNames()
get the list of namesgetOutputStatement
(String toDisplay) get VTL expression used to display specified stringgetParameter
(String key) get engine parameter for provided keygetProgram
(String... statements) get whole VTL program given VTL linesget a Velocity script engine
-
Constructor Details
-
VelocityScriptEngineFactory
public VelocityScriptEngineFactory()
-
-
Method Details
-
getEngineName
get engine name- Specified by:
getEngineName
in interfaceScriptEngineFactory
- Returns:
- engine name, aka "Velocity"
-
getEngineVersion
get engine version- Specified by:
getEngineVersion
in interfaceScriptEngineFactory
- Returns:
- engine version string
-
getExtensions
get the list of file extensions handled by Velocity: vm, vtl, vhtml- Specified by:
getExtensions
in interfaceScriptEngineFactory
- Returns:
- extensions list
-
getLanguageName
get language name- Specified by:
getLanguageName
in interfaceScriptEngineFactory
- Returns:
- language name, aka "VTL"
-
getLanguageVersion
get language version (same as engine version)- Specified by:
getLanguageVersion
in interfaceScriptEngineFactory
- Returns:
- language version string
-
getMethodCallSyntax
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
get the list of Velocity mime types- Specified by:
getMimeTypes
in interfaceScriptEngineFactory
- Returns:
- singleton { 'text/x-velocity' }
-
getNames
get the list of names- Specified by:
getNames
in interfaceScriptEngineFactory
- Returns:
- { 'velocity', 'Velocity' }
-
getOutputStatement
get VTL expression used to display specified string- Specified by:
getOutputStatement
in interfaceScriptEngineFactory
- Parameters:
toDisplay
-- Returns:
- escaped string #[[toDisplay]]#
-
getParameter
get engine parameter for provided key- Specified by:
getParameter
in interfaceScriptEngineFactory
- Parameters:
key
-- Returns:
- found parameter, or null
-
getProgram
get whole VTL program given VTL lines- Specified by:
getProgram
in interfaceScriptEngineFactory
- Parameters:
statements
- VTL lines- Returns:
- lines concatenated with carriage returns
-
getScriptEngine
get a Velocity script engine- Specified by:
getScriptEngine
in interfaceScriptEngineFactory
- Returns:
- a new Velocity script engine
-