1 25 26 package org.netbeans.modules.classfile; 27 28 35 public class Access { 36 37 38 public static final int PUBLIC = 0x0001; 39 40 41 public static final int PRIVATE = 0x0002; 42 43 44 public static final int PROTECTED = 0x0004; 45 46 47 public static final int STATIC = 0x0008; 48 49 54 public static final int FINAL = 0x0010; 55 56 57 public static final int SYNCHRONIZED = 0x0020; 58 59 64 public static final int SUPER = 0x0020; 65 66 67 public static final int VOLATILE = 0x0040; 68 69 70 public static final int BRIDGE = 0x0040; 71 72 76 public static final int TRANSIENT = 0x0080; 77 78 79 public static final int VARARGS = 0x0080; 80 81 82 public static final int NATIVE = 0x0100; 83 84 85 public static final int INTERFACE = 0x0200; 86 87 88 public static final int ABSTRACT = 0x0400; 89 90 91 public static final int STRICT = 0x0800; 92 93 94 public static final int SYNTHETIC = 0x1000; 95 96 97 public static final int ANNOTATION = 0x2000; 98 99 103 public static final int ENUM = 0x4000; 104 105 117 public static String toString(int access) { 118 StringBuffer sb = new StringBuffer (); 119 if ((access & PUBLIC) == PUBLIC) 120 sb.append("public "); if ((access & PRIVATE) == PRIVATE) 122 sb.append("private "); if ((access & PROTECTED) == PROTECTED) 124 sb.append("protected "); if ((access & (PUBLIC | PRIVATE | PROTECTED)) == 0) 126 sb.append("package private "); if ((access & STATIC) == STATIC) 128 sb.append("static "); if ((access & FINAL) == FINAL) 130 sb.append("final "); if ((access & SYNCHRONIZED) == SYNCHRONIZED) 132 sb.append("synchronized "); if ((access & VOLATILE) == VOLATILE) 134 sb.append("volatile "); if ((access & TRANSIENT) == TRANSIENT) 136 sb.append("transient "); if ((access & NATIVE) == NATIVE) 138 sb.append("native "); if ((access & ABSTRACT) == ABSTRACT) 140 sb.append("abstract "); if ((access & STRICT) == STRICT) 142 sb.append("strict "); 144 return sb.substring(0, sb.length()-1); 146 } 147 148 public static boolean isStatic(int access) { 149 return ((access & STATIC) == STATIC); 150 } 151 152 public static final boolean isPublic(int access) { 153 return ((access & PUBLIC) == PUBLIC); 154 } 155 156 public static final boolean isProtected(int access) { 157 return ((access & PROTECTED) == PROTECTED); 158 } 159 160 public static final boolean isPackagePrivate(int access) { 161 return ((access & (PUBLIC | PRIVATE | PROTECTED)) == 0); 162 } 163 164 public static final boolean isPrivate(int access) { 165 return ((access & PRIVATE) == PRIVATE); 166 } 167 168 private Access() { 169 } 171 } 172 | Popular Tags |