KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > types > MethodInstance


1 package polyglot.types;
2
3 import java.util.List JavaDoc;
4
5 /**
6  * A <code>MethodInstance</code> represents the type information for a Java
7  * method.
8  */

9 public interface MethodInstance extends ProcedureInstance
10 {
11     /**
12      * The method's return type.
13      */

14     Type returnType();
15
16     /**
17      * Set the method's return type.
18      */

19     MethodInstance returnType(Type returnType);
20
21     /**
22      * The method's name.
23      */

24     String JavaDoc name();
25
26     /**
27      * Set the method's name.
28      */

29     MethodInstance name(String JavaDoc name);
30
31     /**
32      * Set the method's flags.
33      */

34     MethodInstance flags(Flags flags);
35
36     /**
37      * Set the method's formal parameter types.
38      * @param l A list of <code>Type</code>.
39      * @see polyglot.types.Type
40      */

41     MethodInstance formalTypes(List JavaDoc l);
42
43     /**
44      * Set the method's exception throw types.
45      * @param l A list of <code>Type</code>.
46      * @see polyglot.types.Type
47      */

48     MethodInstance throwTypes(List JavaDoc l);
49
50     /**
51      * Set the method's containing type.
52      */

53     MethodInstance container(ReferenceType container);
54
55     /**
56      * Get the list of methods this method (potentially) overrides, in order
57      * from this class (i.e., including <code>this</code>) to super classes.
58      * @return A list of <code>MethodInstance</code>, starting with
59      * <code>this</code>. Note that this list does not include methods declared
60      * in interfaces. Use <code>implemented</code> for that.
61      * @see polyglot.types.MethodInstance
62      */

63     List JavaDoc overrides();
64
65     /**
66      * Return true if this method can override <code>mi</code>, false otherwise.
67      */

68     boolean canOverride(MethodInstance mi);
69
70     /**
71      * Return true if this method can override <code>mi</code>, throws
72      * a SemanticException otherwise.
73      */

74     void checkOverride(MethodInstance mi) throws SemanticException;
75
76     /**
77      * Get the set of methods this method implements. No ordering is
78      * specified since the superinterfaces need not form a linear list
79      * (i.e., they can form a tree).
80      * @return List[MethodInstance]
81      */

82     List JavaDoc implemented();
83     
84     /**
85      * Return true if this method has the same signature as <code>mi</code>.
86      */

87     boolean isSameMethod(MethodInstance mi);
88
89     /**
90      * Return true if this method can be called with name <code>name</code>
91      * and actual parameters of types <code>actualTypes</code>.
92      * @param name The method to call.
93      * @param actualTypes A list of argument types of type <code>Type</code>.
94      * @see polyglot.types.Type
95      */

96     boolean methodCallValid(String JavaDoc name, List JavaDoc actualTypes);
97
98     /**
99      * Get the list of methods this method (potentially) overrides, in order
100      * from this class (i.e., including <code>this</code>) to super classes.
101      * This method should not be called except by <code>TypeSystem</code>
102      * and by subclasses.
103      * @return A list of <code>MethodInstance</code>, starting with
104      * <code>this</code>.
105      * @see polyglot.types.MethodInstance
106      */

107     List JavaDoc overridesImpl();
108
109     /**
110      * Return true if this method can override <code>mi</code>.
111      * This method should not be called except by <code>TypeSystem</code>
112      * and by subclasses.
113      * If quiet is true and this method cannot override <code>mi</code>, then
114      * false is returned; otherwise, if quiet is false and this method cannot
115      * override <code>mi</code>, then a SemanticException is thrown.
116      */

117     boolean canOverrideImpl(MethodInstance mi, boolean quiet) throws SemanticException;
118
119     /**
120      * Get the set of methods in rt and its superinterfaces that
121      * this method implements. No ordering is specified.
122      * @return List[MethodInstance]
123      * @param rt The point in the type hierarchy to begin looking for methods.
124      */

125     List JavaDoc implementedImpl(ReferenceType rt);
126     
127     /**
128      * Return true if this method has the same signature as <code>mi</code>.
129      * This method should not be called except by <code>TypeSystem</code>
130      * and by subclasses.
131      */

132     boolean isSameMethodImpl(MethodInstance mi);
133
134     /**
135      * Return true if this method can be called with name <code>name</code>
136      * and actual parameters of types <code>actualTypes</code>.
137      * This method should not be called except by <code>TypeSystem</code>
138      * and by subclasses.
139      */

140     boolean methodCallValidImpl(String JavaDoc name, List JavaDoc actualTypes);
141 }
142
Popular Tags