Package org.zkoss.zk.scripting
Class Interpreters
- java.lang.Object
-
- org.zkoss.zk.scripting.Interpreters
-
public class Interpreters extends java.lang.Object
The utilities to access interpreters (Interpreter
).Application developers and deployers rarely need to access this class directly. Rather, they can declare the interpreter class in either zk/config.xml or WEB-INF/zk.xml.
- Author:
- tomyeh
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
add(java.lang.String zslang, java.lang.String ipcls)
Adds an interpreter class.static java.lang.String
add(Element config)
Adds an interpreter based on the XML declaration.static boolean
exists(java.lang.String zslang)
Tests whether the interpreter for the specified language name exists.static java.util.Set<java.lang.String>
getZScriptLanguages()
Returns a set of names of the scripting languages supported by this installation.static boolean
isLegalName(char cc)
Tests whether a character is legal to be used as part of the scripting language name.static Interpreter
newInterpreter(java.lang.String zslang, Page owner)
Returns the interpreter for the specified language name.
-
-
-
Method Detail
-
newInterpreter
public static final Interpreter newInterpreter(java.lang.String zslang, Page owner)
Returns the interpreter for the specified language name.- Parameters:
zslang
- the name of the scripting language, say, Java.- Throws:
InterpreterNotFoundException
- if not found.
-
exists
public static final boolean exists(java.lang.String zslang)
Tests whether the interpreter for the specified language name exists.- Parameters:
zslang
- the name of the scripting language, say, Java.
-
getZScriptLanguages
public static final java.util.Set<java.lang.String> getZScriptLanguages()
Returns a set of names of the scripting languages supported by this installation.
-
add
public static final java.lang.String add(java.lang.String zslang, java.lang.String ipcls)
Adds an interpreter class.- Parameters:
zslang
- the name of the scripting language, say, Java. It is case insensitive.ipcls
- the class name of interpreter (Interpreter
).- Returns:
- the previous class name, or null if not defined yet
-
add
public static final java.lang.String add(Element config)
Adds an interpreter based on the XML declaration.<zscript-config> <language-name>SuperJava</language-name><!-- case insensitive --!> <interpreter-class>my.MySuperJavaInterpreter</interpreter-class> </zscript-config>
- Parameters:
config
- the XML element called zscript-config- Returns:
- the previous class, or null if not defined yet
-
isLegalName
public static boolean isLegalName(char cc)
Tests whether a character is legal to be used as part of the scripting language name.
-
-