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`

      public class JythonInterpreter
      extends GenericInterpreter

  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
    Constructor | Description
    --- | ---
    `JythonInterpreter()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` | Reset the owner (`GenericInterpreter.getOwner()`) to null.
    `protected void` | `exec​(java.lang.String script)` | Executes the specified script.
    `protected java.lang.Object` | `get​(java.lang.String name)` | Gets the variable from the interpreter.
    `java.lang.Object` | `getNativeInterpreter()` | Returns the native interpreter, or null if not available.
    `void` | `init​(Page owner, java.lang.String zslang)` | Initializes the interpreter.
    `protected void` | `set​(java.lang.String name, java.lang.Object value)` | Sets the variable to the interpreter.
    `protected void` | `unset​(java.lang.String name)` | Removes 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`

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

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

- - ### Constructor Detail

    - #### JythonInterpreter

          public JythonInterpreter()

  - ### Method Detail

    - #### init

          public void init​(Page owner,
                           java.lang.String zslang)

      Description copied from interface: `Interpreter`
      Initializes the interpreter. It is called once when the new instance of interpreter is constructed.
      Specified by:
        `init` in interface `Interpreter`
      Overrides:
        `init` in class `GenericInterpreter`
        `zslang` - the language this interpreter is associated with

    - #### exec

          protected void exec​(java.lang.String script)

      Description copied from class: `GenericInterpreter`
      Executes the specified script. Deriving class shall provide an implementation of this method, rather than overriding `GenericInterpreter.interpret(java.lang.String, org.zkoss.zk.ui.ext.Scope)`.
      Specified by:
        `exec` in class `GenericInterpreter`

    - #### destroy

          public void destroy()

      Description copied from class: `GenericInterpreter`
      Reset the owner (`GenericInterpreter.getOwner()`) to null.
      Specified by:
        `destroy` in interface `Interpreter`
      Overrides:
        `destroy` in class `GenericInterpreter`

    - #### get

          protected java.lang.Object get​(java.lang.String name)

      Description copied from class: `GenericInterpreter`
      Gets 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:
        `get` in class `GenericInterpreter`

    - #### set

          protected void set​(java.lang.String name,
                             java.lang.Object value)

      Description copied from class: `GenericInterpreter`
      Sets 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:
        `set` in class `GenericInterpreter`

    - #### unset

          protected void unset​(java.lang.String name)

      Description copied from class: `GenericInterpreter`
      Removes 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:
        `unset` in class `GenericInterpreter`

    - #### getNativeInterpreter

          public java.lang.Object getNativeInterpreter()

      Description copied from interface: `Interpreter`
      Returns the native interpreter, or null if not available. The native interpreter depends on the implementation of an interpreter.