Enum Class ElementFlag
- All Implemented Interfaces:
Serializable,Comparable<ElementFlag>,Constable
This enum provides a comprehensive set of flags for identifying Java language modifiers (public, private, static, etc.)
and other attributes (synthetic, deprecated, etc.) that can be present on program elements. Each modifier has both
a positive flag (e.g.,
Features:
- Java modifiers - all standard Java modifiers (public, private, protected, static, final, etc.)
- Negated flags - each modifier has a corresponding NOT_* flag for filtering
- Non-modifier attributes - flags for synthetic, deprecated, bridge methods, etc.
- Type attributes - flags for identifying classes, interfaces, enums, records, annotations
Use Cases:
- Filtering classes, methods, fields by modifiers
- Identifying special attributes (synthetic, deprecated, bridge methods)
- Type checking (enum, record, annotation, interface)
- Building frameworks that need to analyze program element characteristics
Usage:
Modifier Flags:
Standard Java modifiers:
Attribute Flags:
Non-modifier attributes:
See Also:
ElementInfo- Base class that uses these flags- Reflection Package
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionABSTRACT modifierANNOTATION (is an annotation type)ANONYMOUS (is an anonymous class)ARRAY (is an array type)BRIDGE (is a bridge method)CLASS (is a class, not an interface)CONSTRUCTOR (is a constructor)DEFAULT (is a default interface method)DEPRECATED (has @Deprecated annotation)ENUM (is an enum type)ENUM_CONSTANT (is an enum constant field)FINAL modifierHAS_NO_PARAMS (has no parameters)HAS_PARAMS (has parameters)INTERFACE modifierLOCAL (is a local class)MEMBER (is a member class)NATIVE modifierNON_STATIC_MEMBER (is a non-static member class)NOT_ABSTRACT (negated)NOT_ANNOTATION (not an annotation type)NOT_ANONYMOUS (not an anonymous class)NOT_ARRAY (not an array type)NOT_BRIDGE (not a bridge method)NOT_CONSTRUCTOR (not a constructor)NOT_DEFAULT (not a default interface method)NOT_DEPRECATED (no @Deprecated annotation)NOT_ENUM (not an enum type)NOT_ENUM_CONSTANT (not an enum constant field)NOT_FINAL (negated)NOT_LOCAL (not a local class)NOT_MEMBER (not a member class)NOT_NATIVE (negated)NOT_NON_STATIC_MEMBER (not a non-static member class)NOT_PRIMITIVE (not a primitive type)NOT_PRIVATE (negated)NOT_PROTECTED (negated)NOT_PUBLIC (negated)NOT_RECORD (not a record type)NOT_SEALED (not a sealed class)NOT_STATIC (negated)NOT_SYNCHRONIZED (negated)NOT_SYNTHETIC (not compiler-generated)NOT_TRANSIENT (negated)NOT_VARARGS (does not have variable arity)NOT_VOLATILE (negated)PRIMITIVE (is a primitive type)PRIVATE modifierPROTECTED modifierPUBLIC modifierRECORD (is a record type)SEALED (is a sealed class)STATIC modifierSYNCHRONIZED modifierSYNTHETIC (is compiler-generated)TRANSIENT modifierVARARGS (has variable arity)VOLATILE modifier -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementFlagReturns the enum constant of this class with the specified name.static ElementFlag[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PUBLIC
PUBLIC modifier -
NOT_PUBLIC
NOT_PUBLIC (negated) -
PRIVATE
PRIVATE modifier -
NOT_PRIVATE
NOT_PRIVATE (negated) -
PROTECTED
PROTECTED modifier -
NOT_PROTECTED
NOT_PROTECTED (negated) -
STATIC
STATIC modifier -
NOT_STATIC
NOT_STATIC (negated) -
FINAL
FINAL modifier -
NOT_FINAL
NOT_FINAL (negated) -
SYNCHRONIZED
SYNCHRONIZED modifier -
NOT_SYNCHRONIZED
NOT_SYNCHRONIZED (negated) -
VOLATILE
VOLATILE modifier -
NOT_VOLATILE
NOT_VOLATILE (negated) -
TRANSIENT
TRANSIENT modifier -
NOT_TRANSIENT
NOT_TRANSIENT (negated) -
NATIVE
NATIVE modifier -
NOT_NATIVE
NOT_NATIVE (negated) -
INTERFACE
INTERFACE modifier -
ABSTRACT
ABSTRACT modifier -
NOT_ABSTRACT
NOT_ABSTRACT (negated) -
ANNOTATION
ANNOTATION (is an annotation type) -
NOT_ANNOTATION
NOT_ANNOTATION (not an annotation type) -
ANONYMOUS
ANONYMOUS (is an anonymous class) -
NOT_ANONYMOUS
NOT_ANONYMOUS (not an anonymous class) -
ARRAY
ARRAY (is an array type) -
NOT_ARRAY
NOT_ARRAY (not an array type) -
BRIDGE
BRIDGE (is a bridge method) -
NOT_BRIDGE
NOT_BRIDGE (not a bridge method) -
CLASS
CLASS (is a class, not an interface) -
CONSTRUCTOR
CONSTRUCTOR (is a constructor) -
NOT_CONSTRUCTOR
NOT_CONSTRUCTOR (not a constructor) -
DEFAULT
DEFAULT (is a default interface method) -
NOT_DEFAULT
NOT_DEFAULT (not a default interface method) -
DEPRECATED
DEPRECATED (has @Deprecated annotation) -
NOT_DEPRECATED
NOT_DEPRECATED (no @Deprecated annotation) -
ENUM
ENUM (is an enum type) -
NOT_ENUM
NOT_ENUM (not an enum type) -
ENUM_CONSTANT
ENUM_CONSTANT (is an enum constant field) -
NOT_ENUM_CONSTANT
NOT_ENUM_CONSTANT (not an enum constant field) -
HAS_PARAMS
HAS_PARAMS (has parameters) -
HAS_NO_PARAMS
HAS_NO_PARAMS (has no parameters) -
LOCAL
LOCAL (is a local class) -
NOT_LOCAL
NOT_LOCAL (not a local class) -
MEMBER
MEMBER (is a member class) -
NOT_MEMBER
NOT_MEMBER (not a member class) -
NON_STATIC_MEMBER
NON_STATIC_MEMBER (is a non-static member class) -
NOT_NON_STATIC_MEMBER
NOT_NON_STATIC_MEMBER (not a non-static member class) -
PRIMITIVE
PRIMITIVE (is a primitive type) -
NOT_PRIMITIVE
NOT_PRIMITIVE (not a primitive type) -
RECORD
RECORD (is a record type) -
NOT_RECORD
NOT_RECORD (not a record type) -
SEALED
SEALED (is a sealed class) -
NOT_SEALED
NOT_SEALED (not a sealed class) -
SYNTHETIC
SYNTHETIC (is compiler-generated) -
NOT_SYNTHETIC
NOT_SYNTHETIC (not compiler-generated) -
VARARGS
VARARGS (has variable arity) -
NOT_VARARGS
NOT_VARARGS (does not have variable arity)
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-