Class GroovyInterpreter

    • Constructor Detail

      • GroovyInterpreter

        public GroovyInterpreter()
    • Method Detail

      • getNativeInterpreter

        public java.lang.Object getNativeInterpreter()
        Returns the native interpreter, or null if it is not initialized or destroyed. From application's standpoint, it never returns null, and the returned object must be an instance of GroovyShell
        Since:
        3.0.2
      • contains

        protected boolean contains​(java.lang.String name)
        Description copied from class: GenericInterpreter
        Tests whether a variable is defined in this interpreter. Optional. Implement it if the interpreter can tell the difference between null and undefined.

        By default, it tests whether GenericInterpreter.get(String) returns non-null.

        Overrides:
        contains 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
      • 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
      • getFunction

        public org.zkoss.xel.Function getFunction​(java.lang.String name,
                                                  java.lang.Class[] argTypes)
        Returns the method.

        Currently it only looks for closures, and argTypes are ignored.

        Specified by:
        getFunction in interface Interpreter
        Overrides:
        getFunction in class GenericInterpreter
        argTypes - the list of argument (a.k.a., parameter) types. If null, Class[0] is assumed.