KickJava   Java API By Example, From Geeks To Geeks.

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


1 package sli.kim.classfile;
2
3 import java.util.Vector JavaDoc;
4
5 /**
6 * A common base class for ClassInfo, MethodInfo, and FieldInfo.
7 *
8 * @see ClassInfo
9 * @see MethodInfo
10 * @see FieldInfo
11 */

12 public class CommonInfo {
13     short accessFlags = 0;
14     Vector JavaDoc attributes = new Vector JavaDoc();
15     String JavaDoc name;
16
17     /**
18     * Set the name of this class/method/field.
19     */

20     public void setName(String JavaDoc name) {
21         this.name = name;
22     }
23
24     /**
25     * Get the name of this class/method/field.
26     */

27     public String JavaDoc getName() {
28         return name;
29     }
30
31     /**
32     * Set the access flags of the class.
33     *
34     * @see AccessFlags
35     */

36     public void setAccessFlags(short accessFlags) {
37         this.accessFlags = accessFlags;
38     }
39
40     /**
41     * Get the access flags of the class.
42     *
43     * @see AccessFlags
44     */

45     public short getAccessFlags() {
46         return accessFlags;
47     }
48
49     /**
50     * Add a <i>non-standard</i> attribute. This does not include the Code
51     * attribute for methods, the SourceFile attribute for classes, or the
52     * ConstantValue attribute for fields.
53     */

54     public void addAttribute(AttributeInfo attributeInfo) {
55         attributes.addElement(attributeInfo);
56     }
57
58     /**
59     * Get all <i>non-standard</i> attributes. This does not include the Code
60     * attribute for methods, the SourceFile attribute for classes, or the
61     * ConstantValue attribute for fields.
62     */

63     public AttributeInfo[] getAttributes() {
64         AttributeInfo[] list = new AttributeInfo[attributes.size()];
65         attributes.copyInto(list);
66         return list;
67     }
68 }
Popular Tags