1 13 package org.eclipse.jdt.core; 14 15 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; 16 17 32 public final class Flags { 33 34 38 public static final int AccDefault = ClassFileConstants.AccDefault; 39 43 public static final int AccPublic = ClassFileConstants.AccPublic; 44 48 public static final int AccPrivate = ClassFileConstants.AccPrivate; 49 53 public static final int AccProtected = ClassFileConstants.AccProtected; 54 58 public static final int AccStatic = ClassFileConstants.AccStatic; 59 63 public static final int AccFinal = ClassFileConstants.AccFinal; 64 68 public static final int AccSynchronized = ClassFileConstants.AccSynchronized; 69 73 public static final int AccVolatile = ClassFileConstants.AccVolatile; 74 78 public static final int AccTransient = ClassFileConstants.AccTransient; 79 83 public static final int AccNative = ClassFileConstants.AccNative; 84 88 public static final int AccInterface = ClassFileConstants.AccInterface; 89 93 public static final int AccAbstract = ClassFileConstants.AccAbstract; 94 98 public static final int AccStrictfp = ClassFileConstants.AccStrictfp; 99 103 public static final int AccSuper = ClassFileConstants.AccSuper; 104 108 public static final int AccSynthetic = ClassFileConstants.AccSynthetic; 109 113 public static final int AccDeprecated = ClassFileConstants.AccDeprecated; 114 115 121 public static final int AccBridge = ClassFileConstants.AccBridge; 122 123 129 public static final int AccVarargs = ClassFileConstants.AccVarargs; 130 131 136 public static final int AccEnum = ClassFileConstants.AccEnum; 137 138 143 public static final int AccAnnotation = ClassFileConstants.AccAnnotation; 144 145 148 private Flags() { 149 } 151 157 public static boolean isAbstract(int flags) { 158 return (flags & AccAbstract) != 0; 159 } 160 167 public static boolean isDeprecated(int flags) { 168 return (flags & AccDeprecated) != 0; 169 } 170 176 public static boolean isFinal(int flags) { 177 return (flags & AccFinal) != 0; 178 } 179 186 public static boolean isInterface(int flags) { 187 return (flags & AccInterface) != 0; 188 } 189 195 public static boolean isNative(int flags) { 196 return (flags & AccNative) != 0; 197 } 198 206 public static boolean isPackageDefault(int flags) { 207 return (flags & (AccPublic | AccPrivate | AccProtected)) == 0; 208 } 209 215 public static boolean isPrivate(int flags) { 216 return (flags & AccPrivate) != 0; 217 } 218 224 public static boolean isProtected(int flags) { 225 return (flags & AccProtected) != 0; 226 } 227 233 public static boolean isPublic(int flags) { 234 return (flags & AccPublic) != 0; 235 } 236 242 public static boolean isStatic(int flags) { 243 return (flags & AccStatic) != 0; 244 } 245 252 public static boolean isSuper(int flags) { 253 return (flags & AccSuper) != 0; 254 } 255 261 public static boolean isStrictfp(int flags) { 262 return (flags & AccStrictfp) != 0; 263 } 264 270 public static boolean isSynchronized(int flags) { 271 return (flags & AccSynchronized) != 0; 272 } 273 280 public static boolean isSynthetic(int flags) { 281 return (flags & AccSynthetic) != 0; 282 } 283 289 public static boolean isTransient(int flags) { 290 return (flags & AccTransient) != 0; 291 } 292 298 public static boolean isVolatile(int flags) { 299 return (flags & AccVolatile) != 0; 300 } 301 302 311 public static boolean isBridge(int flags) { 312 return (flags & AccBridge) != 0; 313 } 314 315 324 public static boolean isVarargs(int flags) { 325 return (flags & AccVarargs) != 0; 326 } 327 328 337 public static boolean isEnum(int flags) { 338 return (flags & AccEnum) != 0; 339 } 340 341 350 public static boolean isAnnotation(int flags) { 351 return (flags & AccAnnotation) != 0; 352 } 353 354 390 public static String toString(int flags) { 391 StringBuffer sb = new StringBuffer (); 392 393 if (isPublic(flags)) 394 sb.append("public "); if (isProtected(flags)) 396 sb.append("protected "); if (isPrivate(flags)) 398 sb.append("private "); if (isStatic(flags)) 400 sb.append("static "); if (isAbstract(flags)) 402 sb.append("abstract "); if (isFinal(flags)) 404 sb.append("final "); if (isNative(flags)) 406 sb.append("native "); if (isSynchronized(flags)) 408 sb.append("synchronized "); if (isTransient(flags)) 410 sb.append("transient "); if (isVolatile(flags)) 412 sb.append("volatile "); if (isStrictfp(flags)) 414 sb.append("strictfp "); 416 int len = sb.length(); 417 if (len == 0) 418 return ""; sb.setLength(len - 1); 420 return sb.toString(); 421 } 422 } 423 | Popular Tags |