1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 package org.codehaus.groovy.ast.expr;
47
48 import groovy.lang.MetaMethod;
49
50 import org.codehaus.groovy.ast.GroovyCodeVisitor;
51 import org.codehaus.groovy.classgen.AsmClassGenerator2;
52
53 /***
54 * A static method call on a class
55 *
56 * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
57 * @version $Revision: 1.3 $
58 */
59 public class StaticMethodCallExpression extends Expression {
60
61 String ownerType;
62 private String method;
63 private Expression arguments;
64 private MetaMethod metaMethod = null;
65
66 public StaticMethodCallExpression(String type, String method, Expression arguments) {
67 ownerType = type;
68 this.method = method;
69 this.arguments = arguments;
70 }
71
72 public void visit(GroovyCodeVisitor visitor) {
73 visitor.visitStaticMethodCallExpression(this);
74 }
75
76 public Expression transformExpression(ExpressionTransformer transformer) {
77 return new StaticMethodCallExpression(type, method, transformer.transform(arguments));
78 }
79
80 protected void resolveType(AsmClassGenerator2 resolver) {
81 arguments.resolve(resolver);
82 resolver.resolve(this);
83 }
84
85 public Expression getArguments() {
86 return arguments;
87 }
88
89 public String getMethod() {
90 return method;
91 }
92
93 public String getText() {
94 return type + "." + method + arguments.getText();
95 }
96
97 public String toString() {
98 return super.toString() + "[type: " + type + " method: " + method + " arguments: " + arguments + "]";
99 }
100 public String getOwnerType() {
101 return ownerType;
102 }
103
104 public void setOwnerType(String ownerType) {
105 this.ownerType = ownerType;
106 }
107
108 public void setMetaMethod(MetaMethod metaMethod) {
109 this.metaMethod = metaMethod;
110 }
111
112 public MetaMethod getMetaMethod() {
113 return metaMethod;
114 }
115
116 }