Interface AccessFlags
- All Superinterfaces:
ClassElement,ClassFileElement,FieldElement,MethodElement
Models the access flags for a class, method, or field. The access flags
appears exactly once in each class, method, or field; a
ClassBuilder and a FieldBuilder chooses an unspecified default value
if access flags are not provided, and a MethodBuilder is always
created with access flags.
AccessFlags cannot be created via a factory method directly; it can
be created with withFlags methods on the respective builders.
A MethodBuilder throws an IllegalArgumentException if it is
supplied an AccessFlags object that changes the preexisting
ACC_STATIC flag of the builder, because the
access flag change may invalidate previously supplied data to the builder.
- API Note:
- The access flags of classes, methods, and fields are modeled as a standalone
object to support streaming as elements for
ClassFileTransform. Other access flags are not elements of aCompoundElementand thus not modeled byAccessFlags; they provide their ownflagsMask,flags, andhasmethods. - Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionflags()Returns the access flags, as a set of flag enums.intReturns the access flags, as a bit mask.booleanhas(AccessFlag flag) Returns whether the specified flag is set.location()Returns theclassfile location for this element, which is either class, method, or field.
-
Method Details
-
flagsMask
int flagsMask()Returns the access flags, as a bit mask. It is in the range of unsigned short,[0, 0xFFFF].- Returns:
- the access flags, as a bit mask
-
flags
Set<AccessFlag> flags()Returns the access flags, as a set of flag enums.- Returns:
- the access flags, as a set of flag enums
- Throws:
IllegalArgumentException- if the flags mask has any undefined bit set- See Also:
-
has
Returns whether the specified flag is set. If the specified flag is not available to this location, returnsfalse.- Parameters:
flag- the flag to test- Returns:
- whether the specified flag is set
- See Also:
-
location
AccessFlag.Location location()Returns theclassfile location for this element, which is either class, method, or field.- Returns:
- the
classfile location for this element, which is either class, method, or field - See Also:
-