Package adams.core.scripting
Class GroovyHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
public class GroovyHandler extends AbstractScriptingHandler
Scripting handler for Groovy.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description GroovyHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
globalInfo()
Returns a string describing the object.Object
invoke(Object o, String methodName, Class[] paramClasses, Object[] paramValues)
Executes the specified method on the current interpreter and returns the result, if any.boolean
isPresent()
Returns whether the handler can be used.Object[]
loadScriptObject(Class cls, PlaceholderFile scriptFile, String scriptOptions, Variables vars)
Loads the scripts object and sets its options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
isPresent
public boolean isPresent()
Returns whether the handler can be used.- Specified by:
isPresent
in classAbstractScriptingHandler
- Returns:
- true if available
-
loadScriptObject
public Object[] loadScriptObject(Class cls, PlaceholderFile scriptFile, String scriptOptions, Variables vars)
Loads the scripts object and sets its options.- Specified by:
loadScriptObject
in classAbstractScriptingHandler
- Parameters:
cls
- the class to instantiatescriptFile
- the external file to loadscriptOptions
- the options to setvars
- the variables to use for expanding- Returns:
- element 0: error messsage (null if ok), element 1: script object
-
invoke
public Object invoke(Object o, String methodName, Class[] paramClasses, Object[] paramValues)
Executes the specified method on the current interpreter and returns the result, if any.- Specified by:
invoke
in classAbstractScriptingHandler
- Parameters:
o
- the object the method should be called from, e.g., an InterpretermethodName
- the name of the methodparamClasses
- the classes of the parametersparamValues
- the values of the parameters- Returns:
- the return value of the method, if any (in that case null)
-
-