Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.core.scripting
Class Groovy

    java.lang.Object
      weka.core.scripting.Groovy

All Implemented Interfaces:
  java.io.Serializable, RevisionHandler

    public class Groovy

extends java.lang.Object
implements java.io.Serializable, RevisionHandler

A helper class for Groovy.

In order to use Groovy, the jar containing all the classes must be present in the CLASSPATH. This jar is normally found in the embeddable sub-directory of the Groovy installation.

Tested with Groovy 1.5.7.

Version:
  $Revision: 5953 $
Author:
  fracpete (fracpete at waikato dot ac dot nz)
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `CLASS_GROOVYCLASSLOADER` the classname of the Groovy classloader.

Constructor Summary
`Groovy()` default constructor, tries to instantiate a Groovy classloader.

Method Summary
`java.lang.Object` | `getClassLoader()` returns the currently used Groovy classloader.
`java.lang.String` | `getRevision()` Returns the revision string.
`static java.lang.Object` | `invoke(java.lang.Object o, java.lang.String methodName, java.lang.Class[] paramClasses, java.lang.Object[] paramValues)` executes the specified method and returns the result, if any.
`java.lang.Object` | `invoke(java.lang.String methodName, java.lang.Class[] paramClasses, java.lang.Object[] paramValues)` executes the specified method on the current interpreter and returns the result, if any.
`static boolean` | `isPresent()` returns whether the Groovy classes are present or not, i.e.
`static void` | `main(java.lang.String[] args)` If no arguments are given, it just prints the presence of the Groovy classes, otherwise it expects a Groovy filename to execute.
`static java.lang.Object` | `newClassLoader()` initializes and returns a Groovy Interpreter.
`static java.lang.Object` | `newInstance(java.io.File file, java.lang.Class template)` loads the module and returns a new instance of it as instance of the provided Java class template.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CLASS_GROOVYCLASSLOADER

    public static final java.lang.String CLASS_GROOVYCLASSLOADER

  the classname of the Groovy classloader.

  See Also:
    Constant Field Values

Constructor Detail

### Groovy

    public Groovy()

  default constructor, tries to instantiate a Groovy classloader.

Method Detail

### getClassLoader

    public java.lang.Object getClassLoader()

  returns the currently used Groovy classloader.

  Returns:
    the classloader, can be null

### invoke

    public java.lang.Object invoke(java.lang.String methodName,
                                   java.lang.Class[] paramClasses,
                                   java.lang.Object[] paramValues)

  executes the specified method on the current interpreter and returns the result, if any.

  Parameters:
    `methodName` - the name of the method
    `paramClasses` - the classes of the parameters
    `paramValues` - the values of the parameters
  Returns:
    the return value of the method, if any (in that case null)

### isPresent

    public static boolean isPresent()

  returns whether the Groovy classes are present or not, i.e. whether the classes are in the classpath or not

  Returns:
    whether the Groovy classes are available

### newClassLoader

    public static java.lang.Object newClassLoader()

  initializes and returns a Groovy Interpreter.

  Returns:
    the interpreter or null if Groovy classes not present

### newInstance

    public static java.lang.Object newInstance(java.io.File file,
                                               java.lang.Class template)

  loads the module and returns a new instance of it as instance of the provided Java class template.

  Parameters:
    `file` - the Groovy module file
    `template` - the template for the returned Java object
  Returns:
    the Groovy object

### invoke

    public static java.lang.Object invoke(java.lang.Object o,
                                          java.lang.String methodName,
                                          java.lang.Class[] paramClasses,
                                          java.lang.Object[] paramValues)

  executes the specified method and returns the result, if any.

  Parameters:
    `o` - the object the method should be called from, e.g., a Groovy Interpreter
    `methodName` - the name of the method
    `paramClasses` - the classes of the parameters
    `paramValues` - the values of the parameters
  Returns:
    the return value of the method, if any (in that case null)

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

### main

    public static void main(java.lang.String[] args)

  If no arguments are given, it just prints the presence of the Groovy classes, otherwise it expects a Groovy filename to execute.

  Parameters:
    `args` - commandline arguments

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD