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 StringgetEngineName()get engine nameStringgetEngineVersion()get engine versionList<String>getExtensions()get the list of file extensions handled by Velocity: vm, vtl, vhtmlStringgetLanguageName()get language nameStringgetLanguageVersion()get language version (same as engine version)StringgetMethodCallSyntax(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 namesStringgetOutputStatement(String toDisplay)get VTL expression used to display specified stringStringgetParameter(String key)get engine parameter for provided keyStringgetProgram(String... statements)get whole VTL program given VTL linesScriptEnginegetScriptEngine()get a Velocity script engine
-
-
-
Method Detail
-
getEngineName
public String getEngineName()
get engine name- Specified by:
getEngineNamein interfaceScriptEngineFactory- Returns:
- engine name, aka "Velocity"
-
getEngineVersion
public String getEngineVersion()
get engine version- Specified by:
getEngineVersionin interfaceScriptEngineFactory- Returns:
- engine version string
-
getExtensions
public List<String> getExtensions()
get the list of file extensions handled by Velocity: vm, vtl, vhtml- Specified by:
getExtensionsin interfaceScriptEngineFactory- Returns:
- extensions list
-
getLanguageName
public String getLanguageName()
get language name- Specified by:
getLanguageNamein interfaceScriptEngineFactory- Returns:
- language name, aka "VTL"
-
getLanguageVersion
public String getLanguageVersion()
get language version (same as engine version)- Specified by:
getLanguageVersionin 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:
getMethodCallSyntaxin 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:
getMimeTypesin interfaceScriptEngineFactory- Returns:
- singleton { 'text/x-velocity' }
-
getNames
public List<String> getNames()
get the list of names- Specified by:
getNamesin interfaceScriptEngineFactory- Returns:
- { 'velocity', 'Velocity' }
-
getOutputStatement
public String getOutputStatement(String toDisplay)
get VTL expression used to display specified string- Specified by:
getOutputStatementin interfaceScriptEngineFactory- Parameters:
toDisplay-- Returns:
- escaped string #[[toDisplay]]#
-
getParameter
public String getParameter(String key)
get engine parameter for provided key- Specified by:
getParameterin interfaceScriptEngineFactory- Parameters:
key-- Returns:
- found parameter, or null
-
getProgram
public String getProgram(String... statements)
get whole VTL program given VTL lines- Specified by:
getProgramin interfaceScriptEngineFactory- Parameters:
statements- VTL lines- Returns:
- lines concatenated with carriage returns
-
getScriptEngine
public ScriptEngine getScriptEngine()
get a Velocity script engine- Specified by:
getScriptEnginein interfaceScriptEngineFactory- Returns:
- a new Velocity script engine
-
-