org.schmant.lang
Interface ClosureRunner

All Known Implementing Classes:
GroovyExecutor, JRubyExecutor, JythonExecutor, MozillaRhinoExecutor, SunJavaScriptExecutor

public interface ClosureRunner

This interface identifies something that is able to run closures. It is used by ClosureSupport.

Since:
1.1
Author:
Karl Gustafsson

Method Summary
 boolean isClosure(Object o)
          Is the object a closure that can be run?
 Object runClosure(Object closure, Object... arguments)
          Run the closure and return the result.
 

Method Detail

isClosure

boolean isClosure(Object o)
Is the object a closure that can be run?

Parameters:
o - The object.
Returns:
true if the object is a closure.

runClosure

Object runClosure(Object closure,
                  Object... arguments)
                  throws SchmantException
Run the closure and return the result.

Parameters:
closure - The closure to run.
arguments - Arguments to the closure.
Returns:
The result from running the closure. This should be the expected value and not some kind of script language wrapper object, such as PyObject.
Throws:
SchmantException - On errors.