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

Modifier and Type
Method
Description
`String`
`getEngineName()`
get engine name
`String`
`getEngineVersion()`
get engine version
`List<String>`
`getExtensions()`
get the list of file extensions handled by Velocity: vm, vtl, vhtml
`String`
`getLanguageName()`
get language name
`String`
`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 arguments
`List<String>`
`getMimeTypes()`
get the list of Velocity mime types
`List<String>`
`getNames()`
get the list of names
`String`
`getOutputStatement(String toDisplay)`
get VTL expression used to display specified string
`String`
`getParameter(String key)`
get engine parameter for provided key
`String`
`getProgram(String... statements)`
get whole VTL program given VTL lines
`ScriptEngine`
`getScriptEngine()`
get a Velocity script engine

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### VelocityScriptEngineFactory

public VelocityScriptEngineFactory()

## Method Details

### getEngineName

public String getEngineName()
get engine name

Specified by:
  `getEngineName` in interface `ScriptEngineFactory`
Returns:
  engine name, aka "Velocity"

### getEngineVersion

public String getEngineVersion()
get engine version

Specified by:
  `getEngineVersion` in interface `ScriptEngineFactory`
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 interface `ScriptEngineFactory`
Returns:
  extensions list

### getLanguageName

public String getLanguageName()
get language name

Specified by:
  `getLanguageName` in interface `ScriptEngineFactory`
Returns:
  language name, aka "VTL"

### getLanguageVersion

public String getLanguageVersion()
get language version (same as engine version)

Specified by:
  `getLanguageVersion` in interface `ScriptEngineFactory`
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 interface `ScriptEngineFactory`
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 interface `ScriptEngineFactory`
Returns:
  singleton { 'text/x-velocity' }

### getNames

public List<String> getNames()
get the list of names

Specified by:
  `getNames` in interface `ScriptEngineFactory`
Returns:
  { 'velocity', 'Velocity' }

### getOutputStatement

public String getOutputStatement(String toDisplay)
get VTL expression used to display specified string

Specified by:
  `getOutputStatement` in interface `ScriptEngineFactory`
Parameters:
  `toDisplay` -
Returns:
  escaped string #[[toDisplay]]#

### getParameter

public String getParameter(String key)
get engine parameter for provided key

Specified by:
  `getParameter` in interface `ScriptEngineFactory`
Parameters:
  `key` -
Returns:
  found parameter, or null

### getProgram

public String getProgram(String... statements)
get whole VTL program given VTL lines

Specified by:
  `getProgram` in interface `ScriptEngineFactory`
Parameters:
  `statements` - VTL lines
Returns:
  lines concatenated with carriage returns

### getScriptEngine

public ScriptEngine getScriptEngine()
get a Velocity script engine

Specified by:
  `getScriptEngine` in interface `ScriptEngineFactory`
Returns:
  a new Velocity script engine