|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgroovy.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.Closurepublic boolean equals(Object obj)
true if the given object is the
target closure for this wrapper as well.
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic groovy.lang.Closure curry(Object[] objects)
curry in class groovy.lang.Closurepublic boolean isCase(Object o)
isCase in class groovy.lang.Closurepublic groovy.lang.Closure asWritable()
asWritable in class groovy.lang.Closurepublic Object getProperty(String property)
getProperty in interface groovy.lang.GroovyObjectgetProperty in class groovy.lang.Closure
public void setProperty(String s,
Object o)
setProperty in interface groovy.lang.GroovyObjectsetProperty in class groovy.lang.Closurepublic int getMaximumNumberOfParameters()
getMaximumNumberOfParameters in class groovy.lang.Closurepublic Class[] getParameterTypes()
getParameterTypes in class groovy.lang.Closurepublic Object getDelegate()
getDelegate in class groovy.lang.Closurepublic void setDelegate(Object o)
setDelegate in class groovy.lang.Closurepublic int getDirective()
getDirective in class groovy.lang.Closurepublic void setDirective(int i)
setDirective in class groovy.lang.Closurepublic int getResolveStrategy()
getResolveStrategy in class groovy.lang.Closurepublic 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 | |||||||||