|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.lang.Closure grails.test.AbstractClosureProxy
public abstract class AbstractClosureProxy
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 |
---|
Fields inherited from class groovy.lang.Closure |
---|
DELEGATE_FIRST, DELEGATE_ONLY, DONE, maximumNumberOfParameters, OWNER_FIRST, OWNER_ONLY, parameterTypes, SKIP, TO_SELF |
Constructor Summary | |
---|---|
AbstractClosureProxy(groovy.lang.Closure closure)
Creates a new instance that wraps the target closure and sends profiling events to the given profiler log. |
Method Summary | |
---|---|
groovy.lang.Closure |
asWritable()
|
Object |
call(Object[] objects)
This is the important one: logs entry and exit of the closure call. |
protected abstract groovy.lang.Closure |
createWrapper(groovy.lang.Closure c)
Called when a new instance of the proxy needs to be created for the given closure. |
groovy.lang.Closure |
curry(Object[] objects)
|
protected abstract void |
doAfterCall(Object[] args)
This method is called after the target closure is invoked. |
protected abstract 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 true if the given object is the
target closure for this wrapper as well. |
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 groovy.lang.Closure |
---|
call, call, clone, getOwner, getThisObject, run, throwRuntimeException |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, invokeMethod, setMetaClass |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractClosureProxy(groovy.lang.Closure closure)
closure
- The target closure to wrap.Method Detail |
---|
protected abstract void doBeforeCall(Object[] args)
args
- The arguments passed to the closure.protected abstract void doAfterCall(Object[] args)
args
- The arguments passed to the closure.protected abstract groovy.lang.Closure createWrapper(groovy.lang.Closure c)
return new MyClosureProxy(c, this.field1, ...)
c
- The closure to wrap/proxy.public Object call(Object[] objects)
call
in class groovy.lang.Closure
public boolean equals(Object obj)
true
if the given object is the
target closure for this wrapper as well.
equals
in class Object
public int hashCode()
hashCode
in class Object
public groovy.lang.Closure curry(Object[] objects)
curry
in class groovy.lang.Closure
public boolean isCase(Object o)
isCase
in class groovy.lang.Closure
public groovy.lang.Closure asWritable()
asWritable
in class groovy.lang.Closure
public Object getProperty(String property)
getProperty
in interface groovy.lang.GroovyObject
getProperty
in class groovy.lang.Closure
public void setProperty(String s, Object o)
setProperty
in interface groovy.lang.GroovyObject
setProperty
in class groovy.lang.Closure
public int getMaximumNumberOfParameters()
getMaximumNumberOfParameters
in class groovy.lang.Closure
public Class[] getParameterTypes()
getParameterTypes
in class groovy.lang.Closure
public Object getDelegate()
getDelegate
in class groovy.lang.Closure
public void setDelegate(Object o)
setDelegate
in class groovy.lang.Closure
public int getDirective()
getDirective
in class groovy.lang.Closure
public void setDirective(int i)
setDirective
in class groovy.lang.Closure
public int getResolveStrategy()
getResolveStrategy
in class groovy.lang.Closure
public void setResolveStrategy(int i)
setResolveStrategy
in class groovy.lang.Closure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |