|
Griffon 0.9.5-rc2 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.Closure
griffon.test.AbstractClosureProxy
@SuppressWarnings("serial") public abstract class AbstractClosureProxy extends Closure
Skeleton implementation of a wrapper class for closures that allows you to intercept invocations of the closure. The wrapper can be used anywhere that the target closure can be used.
Field Summary | |
---|---|
private Closure |
target
|
Fields inherited from class Closure | |
---|---|
OWNER_FIRST, DELEGATE_FIRST, OWNER_ONLY, DELEGATE_ONLY, TO_SELF, DONE, SKIP, IDENTITY |
Constructor Summary | |
AbstractClosureProxy(Closure closure)
Creates a new instance that wraps the target closure and sends profiling events to the given profiler log. |
Method Summary | |
---|---|
Closure
|
asWritable()
|
Object
|
call(Object[] objects)
This is the important one: logs entry and exit of the closure call. |
protected Closure
|
createWrapper(Closure c)
Called when a new instance of the proxy needs to be created for the given closure. |
Closure
|
curry(Object[] objects)
|
protected void
|
doAfterCall(Object[] args)
This method is called after the target closure is invoked. |
protected void
|
doBeforeCall(Object[] args)
This method is called before the target closure is invoked. |
boolean
|
equals(Object obj)
Compares based on identities, but unlike the standard implementation
this one will return |
Object
|
getDelegate()
|
int
|
getDirective()
|
int
|
getMaximumNumberOfParameters()
|
Class[]
|
getParameterTypes()
|
Object
|
getProperty(String property)
|
int
|
getResolveStrategy()
|
int
|
hashCode()
|
boolean
|
isCase(Object o)
|
void
|
setDelegate(Object o)
|
void
|
setDirective(int i)
|
void
|
setProperty(String s, Object o)
|
void
|
setResolveStrategy(int i)
|
Methods inherited from class Closure | |
---|---|
run, setProperty, getProperty, clone, getParameterTypes, setDelegate, getOwner, leftShift, leftShift, rightShift, call, call, call, getDelegate, getMaximumNumberOfParameters, setResolveStrategy, getResolveStrategy, getThisObject, getDirective, setDirective, isCase, asWritable, curry, rcurry, rcurry, ncurry, ncurry, memoize, memoizeAtMost, memoizeAtLeast, memoizeBetween, trampoline, trampoline, getMetaClass, setMetaClass, invokeMethod, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Methods inherited from class GroovyObjectSupport | |
---|---|
setProperty, getProperty, getMetaClass, setMetaClass, invokeMethod, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
private Closure target
Constructor Detail |
---|
public AbstractClosureProxy(Closure closure)
closure
- The target closure to wrap.
Method Detail |
---|
@Override public Closure asWritable()
@Override public Object call(Object[] objects)
protected Closure createWrapper(Closure c)
return new MyClosureProxy(c, this.field1, ...)
c
- The closure to wrap/proxy.
@Override public Closure curry(Object[] objects)
protected void doAfterCall(Object[] args)
args
- The arguments passed to the closure.
protected void doBeforeCall(Object[] args)
args
- The arguments passed to the closure.
@Override public boolean equals(Object obj)
true
if the given object is the
target closure for this wrapper as well.
@Override public Object getDelegate()
@Override public int getDirective()
@Override public int getMaximumNumberOfParameters()
@Override public Class[] getParameterTypes()
@Override public Object getProperty(String property)
@Override public int getResolveStrategy()
@Override public int hashCode()
@Override public boolean isCase(Object o)
@Override public void setDelegate(Object o)
@Override public void setDirective(int i)
@Override public void setProperty(String s, Object o)
@Override public void setResolveStrategy(int i)
Groovy Documentation