|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
MethodClosure.java | - | 0% | 0% | 0% |
|
1 |
package org.codehaus.groovy.runtime;
|
|
2 |
|
|
3 |
import groovy.lang.Closure;
|
|
4 |
import groovy.lang.MetaClass;
|
|
5 |
|
|
6 |
|
|
7 |
/**
|
|
8 |
* Represents a method on an object using a closure which can be invoked
|
|
9 |
* at any time
|
|
10 |
*
|
|
11 |
* @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
|
|
12 |
* @version $Revision: 1.6 $
|
|
13 |
*/
|
|
14 |
public class MethodClosure extends Closure { |
|
15 |
|
|
16 |
private String method;
|
|
17 |
MetaClass metaClass = InvokerHelper.getMetaClass(this);
|
|
18 |
|
|
19 | 0 |
public MethodClosure(Object delegate) {
|
20 | 0 |
super(delegate);
|
21 |
} |
|
22 |
|
|
23 | 0 |
public MethodClosure(Object owner, String method) {
|
24 | 0 |
super(owner);
|
25 | 0 |
this.method = method;
|
26 |
} |
|
27 |
|
|
28 | 0 |
public String getMethod() {
|
29 | 0 |
return method;
|
30 |
} |
|
31 |
|
|
32 | 0 |
public Object call(Object arguments) {
|
33 | 0 |
return InvokerHelper.invokeMethod(getDelegate(), method, arguments);
|
34 |
} |
|
35 |
|
|
36 | 0 |
public MetaClass getMetaClass() {
|
37 | 0 |
return metaClass;
|
38 |
} |
|
39 |
|
|
40 | 0 |
public void setMetaClass(MetaClass metaClass) { |
41 | 0 |
this.metaClass = metaClass;
|
42 |
} |
|
43 |
|
|
44 | 0 |
protected Object doCall(Object arguments) {
|
45 | 0 |
return InvokerHelper.invokeMethod(getDelegate(), method, arguments);
|
46 |
} |
|
47 |
} |
|
48 |
|
|