1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package groovy.lang;
19
20 import java.lang.reflect.Method;
21 import java.util.List;
22
23 import org.codehaus.groovy.ast.ClassNode;
24 import org.codehaus.groovy.runtime.InvokerHelper;
25
26 /***
27 * @author John Wilson
28 *
29 */
30
31 public class DelegatingMetaClass extends MetaClass {
32 protected final MetaClass delegate;
33
34 public DelegatingMetaClass(final MetaClass delegate) {
35 super(delegate.theClass);
36
37 this.delegate = delegate;
38 }
39
40 public DelegatingMetaClass(final Class theClass) {
41 this(new MetaClassImpl(InvokerHelper.getInstance().getMetaRegistry(), theClass));
42 }
43
44
45
46
47 public void addNewInstanceMethod(Method method) {
48 delegate.addNewInstanceMethod(method);
49 }
50
51
52
53 public void addNewStaticMethod(Method method) {
54 delegate.addNewStaticMethod(method);
55 }
56
57
58
59 public void initialize() {
60 delegate.initialize();
61 }
62
63
64
65
66 public Object getAttribute(Object object, String attribute) {
67 return delegate.getAttribute(object, attribute);
68 }
69
70
71
72 public ClassNode getClassNode() {
73 return delegate.getClassNode();
74 }
75
76
77
78 public List getMetaMethods() {
79 return delegate.getMetaMethods();
80 }
81
82
83
84 public List getMethods() {
85 return delegate.getMethods();
86 }
87
88
89
90 public List getProperties() {
91 return delegate.getProperties();
92 }
93
94
95
96 public Object getProperty(Object object, String property) {
97 return delegate.getProperty(object, property);
98 }
99
100
101
102 public Object invokeConstructor(Object[] arguments) {
103 return delegate.invokeConstructor(arguments);
104 }
105
106
107
108
109 public Object invokeMethod(Object object, String methodName, Object arguments) {
110 return delegate.invokeMethod(object, methodName, arguments);
111 }
112
113
114
115 public Object invokeMethod(Object object, String methodName, Object[] arguments) {
116 return delegate.invokeMethod(object, methodName, arguments);
117 }
118
119
120
121 public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
122 return delegate.invokeStaticMethod(object, methodName, arguments);
123 }
124
125
126
127
128 public void setAttribute(Object object, String attribute, Object newValue) {
129 delegate.setAttribute(object, attribute, newValue);
130 }
131
132
133
134 public void setProperty(Object object, String property, Object newValue) {
135 delegate.setProperty(object, property, newValue);
136 }
137
138
139
140 public boolean equals(Object obj) {
141 return delegate.equals(obj);
142 }
143
144
145
146 public int hashCode() {
147 return delegate.hashCode();
148 }
149
150
151
152 public String toString() {
153 return delegate.toString();
154 }
155 /***
156 * @deprecated
157 */
158 public MetaMethod pickMethod(String methodName, Class[] arguments) {
159 return delegate.pickMethod(methodName,arguments);
160 }
161 /***
162 * @deprecated
163 */
164 protected MetaMethod retrieveMethod(String methodName, Class[] arguments) {
165 return delegate.retrieveMethod(methodName,arguments);
166 }
167 }