Griffon 0.9.5-rc2

griffon.util
[Java] Class CallableWithArgs

java.lang.Object
  griffon.util.CallableWithArgs
All Implemented Interfaces:
Callable

public abstract class CallableWithArgs
extends Object

A Callable that can have arguments. Instances of this class can be seen as substitutes for Closures when dealing with non-Groovy languages. There are several Griffon core and Griffon plugin APIs that accept a CallableWithArgs where a Closure would be used.

Example:

Callable<Boolean> c = new CallableWithArgs<Boolean>() {
    public Boolean call(Object[] args) {
        return "Hello".equals(args[0]);
    }
};

c.setArgs("Hello");
assert c.call()
c.setArgs("world!");
assert !c.call();
assert !c.call(new Object[]{ "again" });
 
Authors:
Andres Almiray


Field Summary
private static Object[] NO_ARGS

private Object[] args

private Object[] lock

 
Constructor Summary
CallableWithArgs()

 
Method Summary
Object call()

Object call(Object[] args)

Object[] getArgs()

void setArgs(Object[] args)

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

NO_ARGS

private static final Object[] NO_ARGS


args

private Object[] args


lock

private final Object[] lock


 
Constructor Detail

CallableWithArgs

CallableWithArgs()


 
Method Detail

call

public final Object call()


call

public Object call(Object[] args)


getArgs

public Object[] getArgs()


setArgs

public void setArgs(Object[] args)


 

Groovy Documentation