1 /**********************************************************************/
2 /* Member Info class for J2CPS */
4 /* (c) copyright QUT */
5 /**********************************************************************/
8 import java
.io
.DataInputStream
;
9 import java
.io
.IOException
;
11 public class MemberInfo
{
13 public ClassDesc owner
;
14 public int accessFlags
;
16 public String signature
;
18 public MemberInfo(ConstantPool cp
,DataInputStream stream
,ClassDesc own
)
21 accessFlags
= stream
.readUnsignedShort();
22 name
= (String
) cp
.Get(stream
.readUnsignedShort());
23 signature
= (String
) cp
.Get(stream
.readUnsignedShort());
24 /* skip the attributes */
25 int attrCount
= stream
.readUnsignedShort();
26 for (int i
= 0; i
< attrCount
; i
++) {
27 int attNameIx
= stream
.readUnsignedShort();
28 if ("ConstantValue".equals((String
)cp
.Get(attNameIx
)) &&
29 (this instanceof FieldInfo
)) {
30 ((FieldInfo
)this).GetConstValueAttribute(cp
,stream
);
32 if ("Deprecated".equals((String
)cp
.Get(attNameIx
)) &&
33 (this instanceof MethodInfo
)) { ((MethodInfo
)this).deprecated
= true; }
34 int attrLength
= stream
.readInt();
35 for (int j
= 0; j
< attrLength
; j
++) {
36 int tmp
= stream
.readByte();
42 public MemberInfo(ClassDesc own
,int acc
,String nam
) {
48 public boolean isPublicStatic() {
49 return ConstantPool
.isStatic(accessFlags
) &&
50 ConstantPool
.isPublic(accessFlags
);
53 public boolean isExported() {
54 return (ConstantPool
.isPublic(accessFlags
) ||
55 ConstantPool
.isProtected(accessFlags
));
58 public boolean isPublic() {
59 return ConstantPool
.isPublic(accessFlags
);
62 public boolean isStatic() {
63 return ConstantPool
.isStatic(accessFlags
);
66 public boolean isPrivate() {
67 return ConstantPool
.isPrivate(accessFlags
);
70 public boolean isProtected() {
71 return ConstantPool
.isProtected(accessFlags
);
74 public boolean isAbstract() {
75 return ConstantPool
.isAbstract(accessFlags
);
78 public boolean isFinal() {
79 return ConstantPool
.isFinal(accessFlags
);
83 public String
toString() { return ""; };