Skip to main content
summaryrefslogtreecommitdiffstats
blob: 30f733fd9f6daf46fd1444bb76bbb2193fcfee45 (plain) (blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*******************************************************************************
 * Copyright (c) 2001, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*


 */
package org.eclipse.jem.internal.proxy.core;

import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException;

/**
 * A proxy for a BeanType (i.e. Java type/class). Creation date: (12/3/99 11:38:06 AM)
 * 
 * @author: Joe Winchester
 */
public interface IBeanTypeProxy extends IBeanProxy, IProxyBeanType {
	
	/**
	 * Find the most compatible constructor (out of the declared constructors). This means it will
	 * find either an exact match or an override that is compatible, e.g. X(Object j) is returned when looking with arg type of "java.lang.String".
	 * @param argumentTypes array of arg types or <code>null</code> if none. (In case of null, this is the default ctor, so just use that).
	 * @return
	 * @throws NoSuchMethodException
	 * @throws AmbiguousMethodException
	 * @throws IllegalAccessException 
	 * 
	 * @since 1.1.0
	 */
	public IConstructorProxy getCompatibleConstructor(IBeanTypeProxy[] argumentTypes) throws AmbiguousMethodException, NoSuchMethodException, IllegalAccessException;
	
	/**
	 * Find the most compatible public method, including inheritied. This means it will
	 * find either an exact match or an override that is compatible, e.g. xyz(Object j) is returned when looking with arg type of "java.lang.String".
	 * @param methodName
	 * @param argumentTypes array of arg types or <code>null</code> if none. (In case of null, just use getMethod(String methodName) since only one is compatible then.
	 * @return
	 * @throws AmbiguousMethodException
	 * @throws NoSuchMethodException
	 * 
	 * @since 1.1.0
	 */
	public IMethodProxy getCompatibleMethod(String methodName, IBeanTypeProxy[] argumentTypes)  throws AmbiguousMethodException, NoSuchMethodException;

	/**
	 * Return the constructor proxy on the receiver with the specified arguments Creation date: (12/3/99 2:25:07 PM)
	 */
	public IConstructorProxy getConstructorProxy(String[] argumentClassNames);

	/**
	 * Return the constructor proxy on the receiver with the specified types Creation date: (12/3/99 2:25:07 PM)
	 */
	public IConstructorProxy getConstructorProxy(IBeanTypeProxy[] argumentTypes);
	
	/**
	 * Return an array of public constructors for this class. 
	 * 
	 * @return an array of constructor proxies or <code>null</code> if an error.
	 * 
	 * @since 1.1.0
	 */
	public IConstructorProxy[] getConstructors();

	/**
	 * Return the declared constructor proxy on the receiver with the specified arguments Creation date: (12/3/99 2:25:07 PM)
	 */
	public IConstructorProxy getDeclaredConstructorProxy(String[] argumentClassNames);

	/**
	 * Return the declared constructor proxy on the receiver with the specified types Creation date: (12/3/99 2:25:07 PM)
	 */
	public IConstructorProxy getDeclaredConstructorProxy(IBeanTypeProxy[] argumentTypes);

	/**
	 * Return an array of declared constructors for this class. 
	 * 
	 * @return an array of constructor proxies or <code>null</code> if an error.
	 * 
	 * @since 1.1.0
	 */
	public IConstructorProxy[] getDeclaredConstructors();

	/**
	 * Return the array of field proxies.
	 * @return
	 * 
	 * @since 1.1.0
	 */
	public IFieldProxy[] getFields();

	/**
	 * Return the array of declared field proxies.
	 * @return
	 * 
	 * @since 1.1.0
	 */
	public IFieldProxy[] getDeclaredFields();

	/**
	 * Return the fieldproxy on the receiver with the specified name Creation date: (12/3/99 2:25:07 PM)
	 */
	public IFieldProxy getFieldProxy(String fieldName);

	/**
	 * Return the declared fieldproxy on the receiver with the specified name
	 */
	public IFieldProxy getDeclaredFieldProxy(String fieldName);

	/**
	 * Return the method proxy on the receiver with the specified name and no arguments.
	 * 
	 * @param methodName
	 * @return 
	 * @since 1.0.0
	 */
	public IMethodProxy getMethodProxy(String methodName);

	/**
	 * Return the method proxy on the receiver with the qualified class names as string arguments
	 * 
	 * @param methodName
	 * @param argumentClassNames
	 * @return 
	 * @since 1.0.0
	 */
	public IMethodProxy getMethodProxy(String methodName, String[] argumentClassNames);

	/**
	 * Return the method proxy on the receiver with the specified name and one argument
	 * 
	 * @param methodName
	 * @param argumentClassName
	 * @return 
	 * @since 1.0.0
	 */
	public IMethodProxy getMethodProxy(String methodName, String argumentClassName);

	/**
	 * Return the method proxy on the receiver with the beanTypes as arguments
	 * 
	 * @param methodName
	 * @param argumentTypes
	 * @return 
	 * @since 1.0.0
	 */
	public IMethodProxy getMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes);

	/**
	 * Return an array of public methods for this class. 
	 * 
	 * @return an array of method proxies or <code>null</code> if an error.
	 * 
	 * @since 1.1.0
	 */
	public IMethodProxy[] getMethods();

	/**
	 * Return the declared method proxy on the receiver with the specified arguments Creation date: (12/3/99 2:25:07 PM)
	 */
	public IMethodProxy getDeclaredMethodProxy(String methodName, String[] argumentClassNames);

	/**
	 * Return the declared method proxy on the receiver with the specified types Creation date: (12/3/99 2:25:07 PM)
	 */
	public IMethodProxy getDeclaredMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes);

	/**
	 * Return an array of declared methods for this class. 
	 * 
	 * @return an array of method proxies or <code>null</code> if an error.
	 * 
	 * @since 1.1.0
	 */
	public IMethodProxy[] getDeclaredMethods();

	/**
	 * Return the invokable on the receiver with the specified name and no arguments.
	 * <p>
	 * The method proxy is not retrieved. Instead the method will be looked up
	 * each time on the vm. Because of this these are suitable only for one-shot invokations. If it is to be invoked often, then a method proxy should
	 * be retrieved instead.
	 * <p>
	 * Though typical for one-shot deal the invokable can be used over and over. There is just overhead because the method is looked up each time. So a reasonable compromise
	 * would be if using it infrequently or is used closely together once or twice it is better to use a Invokable instead of a method proxy.
	 * <p>
	 * Note there is no guarantee that the method is available. This won't be known until the actual invoke is done.
	 * 
	 * @param methodName
	 * @return 
	 * @since 1.0.0
	 */
	public IInvokable getInvokable(String methodName);

	/**
	 * Return the method proxy on the receiver with the qualified class names as string arguments
	 * <p>
	 * The method proxy is not retrieved. Instead the method will be looked up
	 * each time on the vm. Because of this these are suitable only for one-shot invokations. If it is to be invoked often, then a method proxy should
	 * be retrieved instead.
	 * <p>
	 * Though typical for one-shot deal the invokable can be used over and over. There is just overhead because the method is looked up each time. So a reasonable compromise
	 * would be if using it infrequently or is used closely together once or twice it is better to use a Invokable instead of a method proxy.
	 * <p>
	 * Note there is no guarantee that the method is available. This won't be known until the actual invoke is done.
	 * 
	 * @param methodName
	 * @param argumentClassNames
	 * @return 
	 * @since 1.0.0
	 */
	public IInvokable getInvokable(String methodName, String[] argumentClassNames);

	/**
	 * Return the method proxy on the receiver with the specified name and one argument
	 * <p>
	 * The method proxy is not retrieved. Instead the method will be looked up
	 * each time on the vm. Because of this these are suitable only for one-shot invokations. If it is to be invoked often, then a method proxy should
	 * be retrieved instead.
	 * <p>
	 * Though typical for one-shot deal the invokable can be used over and over. There is just overhead because the method is looked up each time. So a reasonable compromise
	 * would be if using it infrequently or is used closely together once or twice it is better to use a Invokable instead of a method proxy.
	 * <p>
	 * Note there is no guarantee that the method is available. This won't be known until the actual invoke is done.
	 * 
	 * @param methodName
	 * @param argumentClassName
	 * @return 
	 * @since 1.0.0
	 */
	public IInvokable getInvokable(String methodName, String argumentClassName);

	/**
	 * Return the method proxy on the receiver with the beanTypes as arguments
	 * <p>
	 * The method proxy is not retrieved. Instead the method will be looked up
	 * each time on the vm. Because of this these are suitable only for one-shot invokations. If it is to be invoked often, then a method proxy should
	 * be retrieved instead.
	 * <p>
	 * Though typical for one-shot deal the invokable can be used over and over. There is just overhead because the method is looked up each time. So a reasonable compromise
	 * would be if using it infrequently or is used closely together once or twice it is better to use a Invokable instead of a method proxy.
	 * <p>
	 * Note there is no guarantee that the method is available. This won't be known until the actual invoke is done.
	 * 
	 * @param methodName
	 * @param argumentTypes
	 * @return 
	 * @since 1.0.0
	 */
	public IInvokable getInvokable(String methodName, IBeanTypeProxy[] argumentTypes);
	
	/**
	 * Return the constructor proxy on the receiver with no arguments Creation date: (12/3/99 2:25:07 PM)
	 */
	public IConstructorProxy getNullConstructorProxy();

	/**
	 * Answer the type proxy for the superclass Creation date: (12/3/99 2:25:07 PM)
	 */
	public IBeanTypeProxy getSuperBeanTypeProxy();

	/**
	 * Answer the name of the type we are proxying This is the fully qualified name. For arrays it will return the format: [Lclassname; Creation date:
	 * (12/3/99 2:25:07 PM)
	 */
	public String getTypeName();

	/**
	 * Answer the formal format type name. For normal classes, this just the same as getTypeName(), but for arrays, it is of the format classname[]
	 */
	public String getFormalTypeName();

	/**
	 * Answer a boolean as to whether we are an array type.
	 */
	public boolean isArray();

	/**
	 * Answer a boolean as to whether we are a type or an interface Creation date: (12/3/99 2:25:07 PM)
	 */
	public boolean isInterface();

	/**
	 * Answer a boolean as to whether we are a primitive or not.
	 */
	public boolean isPrimitive();

	/**
	 * Answer a boolean as to whether we are a kind of the argument We can either be it, inherit from it, or implement it
	 */
	public boolean isKindOf(IBeanTypeProxy aBeanProxyType);

	/**
	 * Return a new instance Creation date: (12/3/99 2:25:07 PM)
	 */
	public IBeanProxy newInstance() throws ThrowableProxy;

	/**
	 * Return a new instance of this type using the initialization string to create the proxy. ClassCastException is thrown if the initstring doesn't
	 * result in an object compatible with this type. InstantiationException is thrown when the initialization string cannot be parsed correctly.
	 * Creation date: (12/3/99 2:25:07 PM)
	 */
	public IBeanProxy newInstance(String initializationString) throws ThrowableProxy, ClassCastException, InstantiationException;

	/**
	 * Return the exception message that happened when trying to find this bean type. Class not found is not such an exception. In that case the bean
	 * type will be returned as a null instead. An example of such is an initialization error during loading the class, i.e. it was found but some
	 * static failed to initialize.
	 * 
	 * Return null if there is no initialization error.
	 */
	public String getInitializationError();
}

Back to the top