1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jdo.impl.enhancer.classfile;
19 import java.util.Stack;
20
21 /***
22 * ClassMember is a common base class for ClassMethod and ClassField
23 */
24 abstract public class ClassMember implements VMConstants {
25
26
27
28 /***
29 * Is the member static?
30 */
31 final public boolean isStatic() {
32 return (access() & ACCStatic) != 0;
33 }
34
35 /***
36 * Is the member final?
37 */
38 final public boolean isFinal() {
39 return (access() & ACCFinal) != 0;
40 }
41
42 /***
43 * Turn on or off the final qualifier for the member.
44 */
45 public void setIsFinal(boolean newFinal) {
46 if (newFinal)
47 setAccess(access() | ACCFinal);
48 else
49 setAccess(access() & ~ACCFinal);
50 }
51
52 /***
53 * Is the member private?
54 */
55 final public boolean isPrivate() {
56 return (access() & ACCPrivate) != 0;
57 }
58
59 /***
60 * Is the member protected?
61 */
62 final public boolean isProtected() {
63 return (access() & ACCProtected) != 0;
64 }
65
66 /***
67 * Is the member public?
68 */
69 final public boolean isPublic() {
70 return (access() & ACCPublic) != 0;
71 }
72
73
74
75 /***
76 * Return the access flags for the method - see VMConstants
77 */
78 abstract public int access();
79
80 /***
81 * Set the access flags for the method - see VMConstants
82 */
83 abstract public void setAccess(int newAccess);
84
85 /***
86 * Return the name of the member
87 */
88 abstract public ConstUtf8 name();
89
90 /***
91 * Return the type signature of the method
92 */
93 abstract public ConstUtf8 signature();
94
95 /***
96 * Return the attributes associated with the member
97 */
98 abstract public AttributeVector attributes();
99
100 /***
101 * Compares this instance with another for structural equality.
102 */
103
104 public boolean isEqual(Stack msg, Object obj) {
105 if (!(obj instanceof ClassMember)) {
106 msg.push("obj/obj.getClass() = "
107 + (obj == null ? null : obj.getClass()));
108 msg.push("this.getClass() = "
109 + this.getClass());
110 return false;
111 }
112 ClassMember other = (ClassMember)obj;
113
114 return true;
115 }
116 }