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