Top Description Methods
java.lang.classfile

public sealed Interface AccessFlags

extends ClassElement, MethodElement, FieldElement
Known Direct Implementers
jdk.internal.classfile.impl.AccessFlagsImpl
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.util.Set, jdk.internal.classfile.impl.AccessFlagsImpl, java.lang.reflect.AccessFlag, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use AccessFlags when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

Models the access flags for a class, method, or field. Delivered as a ClassElement, FieldElement, or MethodElement when traversing the corresponding model type.
Since
22

Method Summary

Modifier and TypeMethod and Description
public Set<AccessFlag>

Returns:

the access flags
flags
()

Returns the access flags.

public int

Returns:

the access flags, as a bit mask
flagsMask
()

Returns the access flags, as a bit mask.

public boolean

Returns:

whether the specified flag is present
has
(AccessFlag
the flag to test
flag
)

Returns whether the specified flag is present.

public AccessFlag.Location

Returns:

the classfile location for this element, which is either class, method, or field
location
()

Returns the classfile location for this element, which is either class, method, or field.

public static AccessFlags

Returns:

an AccessFlags for a class
ofClass
(int
the flags to be set, as a bit mask
mask
)

Returns an AccessFlags for a class.

public static AccessFlags

Returns:

an AccessFlags for a class
ofClass
(AccessFlag...
the flags to be set
flags
)

Returns an AccessFlags for a class.

public static AccessFlags

Returns:

an AccessFlags for a field
ofField
(int
the flags to be set, as a bit mask
mask
)

Returns an AccessFlags for a field.

public static AccessFlags

Returns:

an AccessFlags for a field
ofField
(AccessFlag...
the flags to be set
flags
)

Returns an AccessFlags for a field.

public static AccessFlags

Returns:

an AccessFlags for a method
ofMethod
(int
the flags to be set, as a bit mask
mask
)

Returns an AccessFlags for a method.

public static AccessFlags

Returns:

an AccessFlags for a method
ofMethod
(AccessFlag...
the flags to be set
flags
)

Returns an AccessFlags for a method.

Method Detail

flagsback to summary
public Set<AccessFlag> flags()

Returns the access flags.

Returns:Set<AccessFlag>

the access flags

flagsMaskback to summary
public int flagsMask()

Returns the access flags, as a bit mask.

Returns:int

the access flags, as a bit mask

hasback to summary
public boolean has(AccessFlag flag)

Returns whether the specified flag is present. The specified flag should be a valid flag for the classfile location associated with this element otherwise false is returned.

Parameters
flag:AccessFlag

the flag to test

Returns:boolean

whether the specified flag is present

locationback to summary
public AccessFlag.Location location()

Returns the classfile location for this element, which is either class, method, or field.

Returns:AccessFlag.Location

the classfile location for this element, which is either class, method, or field

ofClassback to summary
public static AccessFlags ofClass(int mask)

Returns an AccessFlags for a class.

Parameters
mask:int

the flags to be set, as a bit mask

Returns:AccessFlags

an AccessFlags for a class

ofClassback to summary
public static AccessFlags ofClass(AccessFlag... flags)

Returns an AccessFlags for a class.

Parameters
flags:AccessFlag[]

the flags to be set

Returns:AccessFlags

an AccessFlags for a class

ofFieldback to summary
public static AccessFlags ofField(int mask)

Returns an AccessFlags for a field.

Parameters
mask:int

the flags to be set, as a bit mask

Returns:AccessFlags

an AccessFlags for a field

ofFieldback to summary
public static AccessFlags ofField(AccessFlag... flags)

Returns an AccessFlags for a field.

Parameters
flags:AccessFlag[]

the flags to be set

Returns:AccessFlags

an AccessFlags for a field

ofMethodback to summary
public static AccessFlags ofMethod(int mask)

Returns an AccessFlags for a method.

Parameters
mask:int

the flags to be set, as a bit mask

Returns:AccessFlags

an AccessFlags for a method

ofMethodback to summary
public static AccessFlags ofMethod(AccessFlag... flags)

Returns an AccessFlags for a method.

Parameters
flags:AccessFlag[]

the flags to be set

Returns:AccessFlags

an AccessFlags for a method