1 /*
2 * Copyright 2005 John G. Wilson
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18 package groovy.lang;
19
20 import java.lang.reflect.Constructor;
21 import java.lang.reflect.Method;
22 import java.util.List;
23 import java.util.Map;
24
25 import org.codehaus.groovy.ast.ClassNode;
26
27 /***
28 * @author John Wilson
29 *
30 */
31
32 public class DelegatingMetaClass extends MetaClass {
33 protected final MetaClass delegate;
34 public DelegatingMetaClass(final MetaClass delegate) {
35 super(delegate.getClass());
36
37 this.delegate = delegate;
38 }
39 /* (non-Javadoc)
40 * @see groovy.lang.MetaClass#addNewInstanceMethod(java.lang.reflect.Method)
41 */
42 public void addNewInstanceMethod(Method method) {
43 delegate.addNewInstanceMethod(method);
44 }
45 /* (non-Javadoc)
46 * @see groovy.lang.MetaClass#addNewStaticMethod(java.lang.reflect.Method)
47 */
48 public void addNewStaticMethod(Method method) {
49 delegate.addNewStaticMethod(method);
50 }
51 /* (non-Javadoc)
52 * @see groovy.lang.MetaClass#checkInitialised()
53 */
54 public void checkInitialised() {
55 delegate.checkInitialised();
56 }
57 /* (non-Javadoc)
58 * @see groovy.lang.MetaClass#pickMethod(java.lang.Object, java.lang.String, java.lang.Object[])
59 */
60 public MetaMethod pickMethod(Object object, String methodName, Object[] arguments) {
61 return delegate.pickMethod(object, methodName, arguments);
62 }
63 /* (non-Javadoc)
64 * @see groovy.lang.MetaClass#pickMethod(java.lang.String, java.lang.Class[])
65 */
66 public MetaMethod pickMethod(String methodName, Class[] arguments) {
67 return delegate.pickMethod(methodName, arguments);
68 }
69 /* (non-Javadoc)
70 * @see groovy.lang.MetaClass#getAttribute(java.lang.Object, java.lang.String)
71 */
72 public Object getAttribute(Object object, String attribute) {
73 return delegate.getAttribute(object, attribute);
74 }
75 /* (non-Javadoc)
76 * @see groovy.lang.MetaClass#getClassNode()
77 */
78 public ClassNode getClassNode() {
79 return delegate.getClassNode();
80 }
81 /* (non-Javadoc)
82 * @see groovy.lang.MetaClass#getMetaMethods()
83 */
84 public List getMetaMethods() {
85 return delegate.getMetaMethods();
86 }
87 /* (non-Javadoc)
88 * @see groovy.lang.MetaClass#getMethods()
89 */
90 public List getMethods() {
91 return delegate.getMethods();
92 }
93 /* (non-Javadoc)
94 * @see groovy.lang.MetaClass#getProperties()
95 */
96 public List getProperties() {
97 return delegate.getProperties();
98 }
99 /* (non-Javadoc)
100 * @see groovy.lang.MetaClass#getProperty(java.lang.Object, java.lang.String)
101 */
102 public Object getProperty(Object object, String property) {
103 return delegate.getProperty(object, property);
104 }
105 /* (non-Javadoc)
106 * @see groovy.lang.MetaClass#invokeConstructor(java.lang.Object[])
107 */
108 public Object invokeConstructor(Object[] arguments) {
109 return delegate.invokeConstructor(arguments);
110 }
111 /* (non-Javadoc)
112 * @see groovy.lang.MetaClass#invokeConstructorAt(java.lang.Class, java.lang.Object[])
113 */
114 public Object invokeConstructorAt(Class at, Object[] arguments) {
115 return delegate.invokeConstructorAt(at, arguments);
116 }
117 /* (non-Javadoc)
118 * @see groovy.lang.MetaClass#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object)
119 */
120 public Object invokeMethod(Object object, String methodName, Object arguments) {
121 return delegate.invokeMethod(object, methodName, arguments);
122 }
123 /* (non-Javadoc)
124 * @see groovy.lang.MetaClass#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[])
125 */
126 public Object invokeMethod(Object object, String methodName, Object[] arguments) {
127 return delegate.invokeMethod(object, methodName, arguments);
128 }
129 /* (non-Javadoc)
130 * @see groovy.lang.MetaClass#invokeStaticMethod(java.lang.Object, java.lang.String, java.lang.Object[])
131 */
132 public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
133 return delegate.invokeStaticMethod(object, methodName, arguments);
134 }
135 /* (non-Javadoc)
136 * @see groovy.lang.MetaClass#retrieveConstructor(java.lang.Class[])
137 */
138 public Constructor retrieveConstructor(Class[] arguments) {
139 return delegate.retrieveConstructor(arguments);
140 }
141 /* (non-Javadoc)
142 * @see groovy.lang.MetaClass#retrieveMethod(java.lang.Object, java.lang.String, java.lang.Object[])
143 */
144 public MetaMethod retrieveMethod(Object owner, String methodName, Object[] arguments) {
145 return delegate.retrieveMethod(owner, methodName, arguments);
146 }
147 /* (non-Javadoc)
148 * @see groovy.lang.MetaClass#retrieveMethod(java.lang.String, java.lang.Class[])
149 */
150 public MetaMethod retrieveMethod(String methodName, Class[] arguments) {
151 return delegate.retrieveMethod(methodName, arguments);
152 }
153 /* (non-Javadoc)
154 * @see groovy.lang.MetaClass#retrieveStaticMethod(java.lang.String, java.lang.Class[])
155 */
156 public MetaMethod retrieveStaticMethod(String methodName, Class[] arguments) {
157 return delegate.retrieveStaticMethod(methodName, arguments);
158 }
159 /* (non-Javadoc)
160 * @see groovy.lang.MetaClass#setAttribute(java.lang.Object, java.lang.String, java.lang.Object)
161 */
162 public void setAttribute(Object object, String attribute, Object newValue) {
163 delegate.setAttribute(object, attribute, newValue);
164 }
165 /* (non-Javadoc)
166 * @see groovy.lang.MetaClass#setProperties(java.lang.Object, java.util.Map)
167 */
168 public void setProperties(Object bean, Map map) {
169 delegate.setProperties(bean, map);
170 }
171 /* (non-Javadoc)
172 * @see groovy.lang.MetaClass#setProperty(java.lang.Object, java.lang.String, java.lang.Object)
173 */
174 public void setProperty(Object object, String property, Object newValue) {
175 delegate.setProperty(object, property, newValue);
176 }
177 /* (non-Javadoc)
178 * @see java.lang.Object#equals(java.lang.Object)
179 */
180 public boolean equals(Object obj) {
181 return delegate.equals(obj);
182 }
183 /* (non-Javadoc)
184 * @see java.lang.Object#hashCode()
185 */
186 public int hashCode() {
187 return delegate.hashCode();
188 }
189 /* (non-Javadoc)
190 * @see java.lang.Object#toString()
191 */
192 public String toString() {
193 return delegate.toString();
194 }
195 }