public final class Flags extends Object
This class provides static methods only; it is not intended to be instantiated or subclassed by clients.
Note that the numeric values of these flags match the ones for class files
as described in the Java Virtual Machine Specification. The AST class
Modifier provides the same functionality as this class, only in
the org.eclipse.jdt.core.dom package.
IMember.getFlags()| Modifier and Type | Field and Description |
|---|---|
static int |
AccAbstract
Abstract property flag.
|
static int |
AccAnnotation
Annotation property flag (added in J2SE 1.5).
|
static int |
AccBridge
Bridge method property flag (added in J2SE 1.5).
|
static int |
AccDefault
Constant representing the absence of any flag
|
static int |
AccDeprecated
Deprecated property flag.
|
static int |
AccEnum
Enum property flag (added in J2SE 1.5).
|
static int |
AccFinal
Final access flag.
|
static int |
AccInterface
Interface property flag.
|
static int |
AccNative
Native property flag.
|
static int |
AccPrivate
Private access flag.
|
static int |
AccProtected
Protected access flag.
|
static int |
AccPublic
Public access flag.
|
static int |
AccStatic
Static access flag.
|
static int |
AccStrictfp
Strictfp property flag.
|
static int |
AccSuper
Super property flag.
|
static int |
AccSynchronized
Synchronized access flag.
|
static int |
AccSynthetic
Synthetic property flag.
|
static int |
AccTransient
Transient property flag.
|
static int |
AccVarargs
Varargs method property flag (added in J2SE 1.5).
|
static int |
AccVolatile
Volatile property flag.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAbstract(int flags)
Returns whether the given integer includes the
abstract modifier. |
static boolean |
isAnnotation(int flags)
Returns whether the given integer has the
AccAnnotation
bit set. |
static boolean |
isBridge(int flags)
Returns whether the given integer has the
AccBridge
bit set. |
static boolean |
isDeprecated(int flags)
Returns whether the given integer includes the indication that the
element is deprecated (
@deprecated tag in Javadoc comment). |
static boolean |
isEnum(int flags)
Returns whether the given integer has the
AccEnum
bit set. |
static boolean |
isFinal(int flags)
Returns whether the given integer includes the
final modifier. |
static boolean |
isInterface(int flags)
Returns whether the given integer includes the
interface modifier. |
static boolean |
isNative(int flags)
Returns whether the given integer includes the
native modifier. |
static boolean |
isPackageDefault(int flags)
Returns whether the given integer does not include one of the
public, private, or protected flags. |
static boolean |
isPrivate(int flags)
Returns whether the given integer includes the
private modifier. |
static boolean |
isProtected(int flags)
Returns whether the given integer includes the
protected modifier. |
static boolean |
isPublic(int flags)
Returns whether the given integer includes the
public modifier. |
static boolean |
isStatic(int flags)
Returns whether the given integer includes the
static modifier. |
static boolean |
isStrictfp(int flags)
Returns whether the given integer includes the
strictfp modifier. |
static boolean |
isSuper(int flags)
Returns whether the given integer includes the
super modifier. |
static boolean |
isSynchronized(int flags)
Returns whether the given integer includes the
synchronized modifier. |
static boolean |
isSynthetic(int flags)
Returns whether the given integer includes the indication that the
element is synthetic.
|
static boolean |
isTransient(int flags)
Returns whether the given integer includes the
transient modifier. |
static boolean |
isVarargs(int flags)
Returns whether the given integer has the
AccVarargs
bit set. |
static boolean |
isVolatile(int flags)
Returns whether the given integer includes the
volatile modifier. |
static String |
toString(int flags)
Returns a standard string describing the given modifier flags.
|
public static final int AccDefault
public static final int AccPublic
public static final int AccPrivate
public static final int AccProtected
public static final int AccStatic
public static final int AccFinal
public static final int AccSynchronized
public static final int AccVolatile
public static final int AccTransient
public static final int AccNative
public static final int AccInterface
public static final int AccAbstract
public static final int AccStrictfp
public static final int AccSuper
public static final int AccSynthetic
public static final int AccDeprecated
public static final int AccBridge
public static final int AccVarargs
public static final int AccEnum
public static final int AccAnnotation
public static boolean isAbstract(int flags)
abstract modifier.flags - the flagstrue if the abstract modifier is includedpublic static boolean isDeprecated(int flags)
@deprecated tag in Javadoc comment).flags - the flagstrue if the element is marked as deprecatedpublic static boolean isFinal(int flags)
final modifier.flags - the flagstrue if the final modifier is includedpublic static boolean isInterface(int flags)
interface modifier.flags - the flagstrue if the interface modifier is includedpublic static boolean isNative(int flags)
native modifier.flags - the flagstrue if the native modifier is includedpublic static boolean isPackageDefault(int flags)
public, private, or protected flags.flags - the flagstrue if no visibility flag is setpublic static boolean isPrivate(int flags)
private modifier.flags - the flagstrue if the private modifier is includedpublic static boolean isProtected(int flags)
protected modifier.flags - the flagstrue if the protected modifier is includedpublic static boolean isPublic(int flags)
public modifier.flags - the flagstrue if the public modifier is includedpublic static boolean isStatic(int flags)
static modifier.flags - the flagstrue if the static modifier is includedpublic static boolean isSuper(int flags)
super modifier.flags - the flagstrue if the super modifier is includedpublic static boolean isStrictfp(int flags)
strictfp modifier.flags - the flagstrue if the strictfp modifier is includedpublic static boolean isSynchronized(int flags)
synchronized modifier.flags - the flagstrue if the synchronized modifier is includedpublic static boolean isSynthetic(int flags)
flags - the flagstrue if the element is marked syntheticpublic static boolean isTransient(int flags)
transient modifier.flags - the flagstrue if the transient modifier is includedpublic static boolean isVolatile(int flags)
volatile modifier.flags - the flagstrue if the volatile modifier is includedpublic static boolean isBridge(int flags)
AccBridge
bit set.flags - the flagstrue if the AccBridge flag is includedAccBridgepublic static boolean isVarargs(int flags)
AccVarargs
bit set.flags - the flagstrue if the AccVarargs flag is includedAccVarargspublic static boolean isEnum(int flags)
AccEnum
bit set.flags - the flagstrue if the AccEnum flag is includedAccEnumpublic static boolean isAnnotation(int flags)
AccAnnotation
bit set.flags - the flagstrue if the AccAnnotation flag is includedAccAnnotationpublic static String toString(int flags)
The flags are output in the following order:
This is a compromise between the orders specified in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, 9.1.1, and 9.3 of The Java Language Specification, Second Edition (JLS2).publicprotectedprivatestaticabstractfinalnativesynchronizedtransientvolatilestrictfp
Note that the flags of a method can include the AccVarargs flag that has no standard description. Since the AccVarargs flag has the same value as the AccTransient flag (valid for fields only), attempting to get the description of method modifiers with the AccVarargs flag set would result in an unexpected description. Clients should ensure that the AccVarargs is not included in the flags of a method as follows:
IMethod method = ... int flags = method.getFlags() & ~Flags.AccVarargs; return Flags.toString(flags);
Examples results:
"public static final"
"private native"
flags - the flagsCopyright (c) IBM Corp. and others 2000, 2006. All Rights Reserved.