Groovy Documentation

org.codehaus.groovy.grails.commons.metaclass
[Java] Class ClosureInvokingDynamicMethod

java.lang.Object
  org.codehaus.groovy.grails.commons.metaclass.ClosureInvokingDynamicMethod
All Implemented Interfaces:
java.lang.Cloneable, DynamicMethodInvocation, StaticMethodInvocation

public class ClosureInvokingDynamicMethod
extends java.lang.Object

An implementation of DynamicMethodInvocation that invokes a closure.

Authors:
Graeme Rocher
Since:
0.4


Constructor Summary
ClosureInvokingDynamicMethod(java.lang.String pattern, groovy.lang.Closure closure)

 
Method Summary
protected java.lang.Object clone()

For thread safety when using a ClosureInvokingDynamicMethod it should ALWAYS be cloned first Weird behaviour will occur if a unique cloned instance is not used for each invocation

java.lang.Object invoke(java.lang.Class clazz, java.lang.String methodName, java.lang.Object[] arguments)

java.lang.Object invoke(java.lang.Object target, java.lang.String methodName, java.lang.Object[] arguments)

boolean isMethodMatch(java.lang.String methodName)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

ClosureInvokingDynamicMethod

public ClosureInvokingDynamicMethod(java.lang.String pattern, groovy.lang.Closure closure)


 
Method Detail

clone

@Override
protected java.lang.Object clone()
For thread safety when using a ClosureInvokingDynamicMethod it should ALWAYS be cloned first Weird behaviour will occur if a unique cloned instance is not used for each invocation
throws:
CloneNotSupportedException
Returns:
A cloned instance


invoke

public java.lang.Object invoke(@SuppressWarnings("rawtypes") java.lang.Class clazz, java.lang.String methodName, java.lang.Object[] arguments)


invoke

public java.lang.Object invoke(java.lang.Object target, java.lang.String methodName, java.lang.Object[] arguments)


isMethodMatch

public boolean isMethodMatch(java.lang.String methodName)


 

Groovy Documentation