Package org.zkoss.zk.scripting.jython
Class JythonInterpreter
java.lang.Object
org.zkoss.zk.scripting.util.GenericInterpreter
org.zkoss.zk.scripting.jython.JythonInterpreter
- All Implemented Interfaces:
Interpreter
The Python interpreter based on jython.
Ludovic Drolez implemented the first Jython interpreter for ZK on May 2007: http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/scripting/jython/src/org/zkforge/scripting/jython/
Inspired by Drolez's job, Grace Lin wrote this class on March 2008
- Since:
- 3.0.4
- Author:
- gracelin
-
Field Summary
Fields inherited from class org.zkoss.zk.scripting.util.GenericInterpreter
UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Reset the owner (GenericInterpreter.getOwner()) to null.protected voidExecutes the specified script.protected ObjectGets the variable from the interpreter.Returns the native interpreter, or null if not available.voidInitializes the interpreter.protected voidSets the variable to the interpreter.protected voidRemoves the variable from the interpreter.Methods inherited from class org.zkoss.zk.scripting.util.GenericInterpreter
afterExec, afterInterpret, beforeExec, beforeInterpret, contains, contains, containsVariable, containsVariable, get, getClass, getCurrent, getFromNamespace, getFromNamespace, getFunction, getFunction, getImplicit, getLanguage, getOwner, getVariable, getVariable, interpret, set, setVariable, setVariable, unset, unsetVariable, unsetVariable
-
Constructor Details
-
JythonInterpreter
public JythonInterpreter()
-
-
Method Details
-
init
Description copied from interface:InterpreterInitializes the interpreter. It is called once when the new instance of interpreter is constructed.- Specified by:
initin interfaceInterpreter- Overrides:
initin classGenericInterpreterzslang- the language this interpreter is associated with
-
exec
Description copied from class:GenericInterpreterExecutes the specified script. Deriving class shall provide an implementation of this method, rather than overridingGenericInterpreter.interpret(java.lang.String, org.zkoss.zk.ui.ext.Scope).- Specified by:
execin classGenericInterpreter
-
destroy
public void destroy()Description copied from class:GenericInterpreterReset the owner (GenericInterpreter.getOwner()) to null.- Specified by:
destroyin interfaceInterpreter- Overrides:
destroyin classGenericInterpreter
-
get
Description copied from class:GenericInterpreterGets the variable from the interpreter. Optional. Implement it if you want to expose variables defined in the interpreter to Java codes.GenericInterpreter.beforeExec()is called first, before this method is invoked.An empty (and fake) scope is pushed so
GenericInterpreter.getFromNamespace(java.lang.String)always returns null.- Overrides:
getin classGenericInterpreter
-
set
Description copied from class:GenericInterpreterSets the variable to the interpreter. Optional. Implement it if you want to allow Java codes to define a variable in the interpreter.GenericInterpreter.beforeExec()is called first, before this method is invoked.- Overrides:
setin classGenericInterpreter
-
unset
Description copied from class:GenericInterpreterRemoves the variable from the interpreter. Optional. Implement it if you want to allow Java codes to undefine a variable from the interpreter.GenericInterpreter.beforeExec()is called first, before this method is invoked.- Overrides:
unsetin classGenericInterpreter
-
getNativeInterpreter
Description copied from interface:InterpreterReturns the native interpreter, or null if not available. The native interpreter depends on the implementation of an interpreter.
-