Package org.codehaus.groovy.bsf
Class GroovyEngine
- java.lang.Object
- 
- org.apache.bsf.util.BSFEngineImpl
- 
- org.codehaus.groovy.bsf.GroovyEngine
 
 
- 
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- org.apache.bsf.BSFEngine
 - Direct Known Subclasses:
- CachingGroovyEngine
 
 public class GroovyEngine extends org.apache.bsf.util.BSFEngineImplA BSF Engine for the Groovy scripting language.It's inspired from the Jython engine 
- 
- 
Field SummaryFields Modifier and Type Field Description protected GroovyShellshell
 - 
Constructor SummaryConstructors Constructor Description GroovyEngine()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectapply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)Allow an anonymous function to be declared and invokedObjectcall(Object object, String method, Object[] args)Call the named method of the given object.voiddeclareBean(org.apache.bsf.BSFDeclaredBean bean)Declare a beanObjecteval(String source, int lineNo, int columnNo, Object script)Evaluate an expression.voidexec(String source, int lineNo, int columnNo, Object script)Execute a script.protected GroovyShellgetEvalShell()voidinitialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans)Initialize the engine.voidundeclareBean(org.apache.bsf.BSFDeclaredBean bean)Undeclare a previously declared bean.
 
- 
- 
- 
Field Detail- 
shellprotected GroovyShell shell 
 
- 
 - 
Method Detail- 
applypublic Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws org.apache.bsf.BSFException Allow an anonymous function to be declared and invoked- Specified by:
- applyin interface- org.apache.bsf.BSFEngine
- Overrides:
- applyin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
 - 
callpublic Object call(Object object, String method, Object[] args) throws org.apache.bsf.BSFException Call the named method of the given object.- Throws:
- org.apache.bsf.BSFException
 
 - 
evalpublic Object eval(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException Evaluate an expression.- Throws:
- org.apache.bsf.BSFException
 
 - 
execpublic void exec(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException Execute a script.- Specified by:
- execin interface- org.apache.bsf.BSFEngine
- Overrides:
- execin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
 - 
initializepublic void initialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans) throws org.apache.bsf.BSFExceptionInitialize the engine.- Specified by:
- initializein interface- org.apache.bsf.BSFEngine
- Overrides:
- initializein class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
 - 
declareBeanpublic void declareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFExceptionDeclare a bean- Specified by:
- declareBeanin interface- org.apache.bsf.BSFEngine
- Overrides:
- declareBeanin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
 - 
undeclareBeanpublic void undeclareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFExceptionUndeclare a previously declared bean.- Specified by:
- undeclareBeanin interface- org.apache.bsf.BSFEngine
- Overrides:
- undeclareBeanin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
 - 
getEvalShellprotected GroovyShell getEvalShell() - Returns:
- a newly created GroovyShell using the same variable scope but a new class loader
 
 
- 
 
-