Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
MethodSignature |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | package org.apache.tapestry.enhance; |
|
15 | ||
16 | ||
17 | /** |
|
18 | * A representation of a {@link java.lang.reflect.Method}, identifying the name, return type, |
|
19 | * parameter types and exception types. Actual Method objects are tied to a particular class, and |
|
20 | * don't compare well with other otherwise identical Methods from other classes or interface; |
|
21 | * MethodSignatures are distinct from classes and compare well. |
|
22 | * <p> |
|
23 | * Because the intended purpose is to compare methods from interfaces (which are always public and |
|
24 | * abstract) we don't bother to actually track the modifiers. In addition, at this time, |
|
25 | * MethodSignature <em>does not distinguish between instance and static |
|
26 | * methods</em>. |
|
27 | */ |
|
28 | public interface MethodSignature |
|
29 | { |
|
30 | /** |
|
31 | * Returns the exceptions for this method. Caution: do not modify the returned array. May return |
|
32 | * null. |
|
33 | */ |
|
34 | Class[] getExceptionTypes(); |
|
35 | ||
36 | /** |
|
37 | * The name of the method. |
|
38 | * @return method name |
|
39 | */ |
|
40 | String getName(); |
|
41 | ||
42 | /** |
|
43 | * Returns the parameter types for this method. May return null. Caution: do not modify the |
|
44 | * returned array. |
|
45 | */ |
|
46 | Class[] getParameterTypes(); |
|
47 | ||
48 | /** |
|
49 | * Method return type. |
|
50 | * |
|
51 | * @return The return type of the method. |
|
52 | */ |
|
53 | Class getReturnType(); |
|
54 | ||
55 | /** |
|
56 | * Returns a string consisting of the name of the method and its parameter values. This is |
|
57 | * similar to {@link #toString()}, but omits the return type and information about thrown |
|
58 | * exceptions. A unique id is used by MethodIterator to identify overlapping methods |
|
59 | * (methods with the same name but different thrown exceptions). |
|
60 | * |
|
61 | */ |
|
62 | String getUniqueId(); |
|
63 | ||
64 | /** |
|
65 | * Returns true if this signature has the same return type, name and parameters types as the |
|
66 | * method signature passed in, and this signatures exceptions "trump" (are the same as, or |
|
67 | * super-implementations of, all exceptions thrown by the other method signature). |
|
68 | * |
|
69 | */ |
|
70 | ||
71 | boolean isOverridingSignatureOf(MethodSignature ms); |
|
72 | ||
73 | /** |
|
74 | * If the method definition has generic parameters or return types it |
|
75 | * is expected that this will return true. |
|
76 | * |
|
77 | * @return True if this is a generics based method, false otherwise. |
|
78 | */ |
|
79 | boolean isGeneric(); |
|
80 | } |