KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sli > kim > classfile > MethodInfo


1 package sli.kim.classfile;
2
3 import java.util.Vector JavaDoc;
4
5 /**
6 * A class for storing information about methods.
7 *
8 * @see sli.kim.classfile.ClassInfo#addMethod()
9 */

10 public class MethodInfo extends CommonInfo {
11     private String JavaDoc signature;
12     private Vector JavaDoc exceptions = new Vector JavaDoc();
13     private CodeInfo codeInfo;
14     private boolean deprecated;
15
16     public MethodInfo(short accessFlags, String JavaDoc name, String JavaDoc signature) {
17         setAccessFlags(accessFlags);
18         setName(name);
19         setSignature(signature);
20     }
21
22     /**
23     * Set the signature of the method. For example "([I,S)Ljava/lang/String;"
24     *
25     * @see Signature
26     */

27     public void setSignature(String JavaDoc signature) {
28         this.signature = signature;
29     }
30
31     /**
32     * Get the signature of the method.
33     *
34     * @see Signature
35     */

36     public String JavaDoc getSignature() {
37         return signature;
38     }
39
40     /**
41     * Add a checked exception that the method throws.
42     */

43     public void addException(String JavaDoc exceptionName) {
44         exceptions.addElement(exceptionName);
45     }
46
47     /**
48     * Get all checked exceptions that the method throws.
49     */

50     public String JavaDoc[] getExceptions() {
51         String JavaDoc[] list = new String JavaDoc[exceptions.size()];
52         exceptions.copyInto(list);
53         return list;
54     }
55
56     /**
57     * Set information about this method's code. The CodeInfo need
58     * not be entirely filled in before this method is called.
59     */

60     public void setCodeInfo(CodeInfo codeInfo) {
61         this.codeInfo = codeInfo;
62     }
63
64     /**
65     * Get the information about this method's code. If the method
66     * has no code, this will return null.
67     */

68     public CodeInfo getCodeInfo() {
69         return codeInfo;
70     }
71
72     /**
73     * Set whether this method is deprecated. Methods are not
74     * deprecated until setDeprecated(true) is called.
75     */

76     public void setDeprecated(boolean d) {
77         deprecated = d;
78     }
79
80     /**
81     * Get whether this method is deprecated. Methods are not
82     * deprecated until setDeprecated(true) is called.
83     */

84     public boolean isDeprecated() {
85         return deprecated;
86     }
87 }
Popular Tags