Interface HierarchicalAware
- All Known Implementing Classes:
BSHInterpreter
Interpreter)
if it supports the hierarchical scopes.
By supporting the hierarchical scopes we mean the interpreter
associates one interpreter-dependent scope with each ZK's
IdSpace. And, variables, classes and methods defined
in zscript are then stored in an individual scope depending on
the scope when calling Interpreter.interpret(java.lang.String, org.zkoss.zk.ui.ext.Scope).
On the other hand, if the interpreter doesn't support the hierarchical scopes, it maintains only one global scope and all variables, classes and functions are defined in the global scope.
- Author:
- tomyeh
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsVariable(Scope scope, String name) Tests whether a variable defined in this interpreter.org.zkoss.xel.FunctiongetFunction(Scope scope, String name, Class[] argTypes) Returns the method of the specified name defined in this interpreter's scope identified by the specified scope, or null if not defined.getVariable(Scope scope, String name) Returns the value of a variable defined in this interpreter's scope identified by the specified scope.voidsetVariable(Scope scope, String name, Object value) Sets the value of a variable to this interpreter's scope identified by the specified scope.voidunsetVariable(Scope scope, String name) Removes the value of a variable defined in the interpreter's scope identified by the specified scope.
-
Method Details
-
containsVariable
Tests whether a variable defined in this interpreter. Note: it doesn't search the scope (Scope).It is similar to
Interpreter.containsVariable(java.lang.String), except it uses the specified scope as a reference to identify the correct scope for searching the variable.- Parameters:
scope- the scope used as a reference to identify the correct scope for searching the variable. Note: this method doesn't look for any variable stored in scope.- Since:
- 5.0.0
-
getVariable
Returns the value of a variable defined in this interpreter's scope identified by the specified scope. Note: it doesn't search the specified scope (Scope).It is similar to
Interpreter.getVariable(java.lang.String), except it uses the specified scope as a reference to identify the correct scope for searching the variable.- Parameters:
scope- the scope used as a reference to identify the correct scope for searching the variable. Note: this method doesn't look for any variable stored in scope.- Since:
- 5.0.0
-
setVariable
Sets the value of a variable to this interpreter's scope identified by the specified scope.It is similar to
Interpreter.setVariable(java.lang.String, java.lang.Object), except it uses the specified scope as a reference to identify the correct scope for storing the variable.- Parameters:
scope- the scope used as a reference to identify the correct scope for searching the variable. Note: this method doesn't look for any variable stored in scope.- Since:
- 5.0.0
-
unsetVariable
Removes the value of a variable defined in the interpreter's scope identified by the specified scope.It is similar to
Interpreter.unsetVariable(java.lang.String), except it uses the specified scope as a reference to identify the correct scope for removing the variable.- Parameters:
scope- the scope used as a reference to identify the correct scope for searching the variable. Note: this method doesn't look for any variable stored in scope.- Since:
- 5.0.0
-
getFunction
Returns the method of the specified name defined in this interpreter's scope identified by the specified scope, or null if not defined.It is similar to
Interpreter.getFunction(java.lang.String, java.lang.Class[]), except it uses the specified scope as a reference to identify the correct scope for searching the variable.- Parameters:
scope- the scope used as a reference to identify the correct scope for searching the method. Note: this method doesn't look for any variable stored in scope.argTypes- the list of argument (a.k.a., parameter) types. If null, Class[0] is assumed.- Since:
- 5.0.0
-