public final class Flags extends Object
This class provides static methods only.
Note that the numeric values of these flags match the ones for class files
as described in the Java Virtual Machine Specification (except for
AccDeprecated
, AccAnnotationDefault
, and AccDefaultMethod
).
The AST class Modifier
provides
similar 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 |
AccAnnotationDefault
Annotation method default property flag.
|
static int |
AccBridge
Bridge method property flag (added in J2SE 1.5).
|
static int |
AccDefault
Constant representing the absence of any flag.
|
static int |
AccDefaultMethod
Default method property 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 |
isAnnnotationDefault(int flags)
Returns whether the given integer has the
AccAnnnotationDefault
bit set. |
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 |
isDefaultMethod(int flags)
Returns whether the given integer has the
AccDefaultMethod
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
Note that this flag's value is internal and is not defined in the Virtual Machine specification.
public static final int AccBridge
public static final int AccVarargs
public static final int AccEnum
public static final int AccAnnotation
public static final int AccDefaultMethod
Note that this flag's value is internal and is not defined in the Virtual Machine specification.
public static final int AccAnnotationDefault
Note that this flag's value is internal and is not defined in the Virtual Machine specification.
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 includedAccBridge
public static boolean isVarargs(int flags)
AccVarargs
bit set.flags
- the flagstrue
if the AccVarargs
flag is includedAccVarargs
public static boolean isEnum(int flags)
AccEnum
bit set.flags
- the flagstrue
if the AccEnum
flag is includedAccEnum
public static boolean isAnnotation(int flags)
AccAnnotation
bit set.flags
- the flagstrue
if the AccAnnotation
flag is includedAccAnnotation
public static boolean isDefaultMethod(int flags)
AccDefaultMethod
bit set. Note that this flag represents the usage of the 'default' keyword
on a method and should not be confused with the 'package' access visibility (which used to be called 'default access').true
if the AccDefaultMethod
flag is includedAccDefaultMethod
public static boolean isAnnnotationDefault(int flags)
AccAnnnotationDefault
bit set.true
if the AccAnnotationDefault
flag is includedAccAnnotationDefault
public static String toString(int flags)
The flags are output in the following order:
public protected private abstract default static final synchronized native strictfp transient volatile
This order is consistent with the recommendations in JLS8 ("*Modifier:" rules in chapters 8 and 9).
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 flags
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.