APIdia Launch Partner
Top Description Methods
java.lang.classfile.attribute

public sealed Interface InnerClassInfo

permits UnboundInnerClassInfo
Known Direct Implementers
jdk.internal.classfile.impl.UnboundAttribute.UnboundInnerClassInfo
Imports
java.lang.classfile.constantpool.ClassEntry, .Utf8Entry, java.lang.constant.ClassDesc, java.lang.reflect.AccessFlag, java.util.Optional, .Set, jdk.internal.classfile.impl.TemporaryConstantPool, .UnboundAttribute, .Util

Models a single entry in the InnerClassesAttribute.
Since
24
Java Virtual Machine Specification
4.7.6 The InnerClasses Attribute
See Also
InnerClassesAttribute#classes()

Method Summary

Modifier and TypeMethod and Description
public default Set<AccessFlag>

Returns:

a set of flag enums denoting access permissions and properties of the nested class
flags
()

Returns a set of flag enums denoting access permissions and properties of the nested class.

public int

Returns:

a bit mask of flags denoting access permissions and properties of the inner class
flagsMask
()

Returns a bit mask of flags denoting access permissions and properties of the inner class.

public default boolean

Returns:

whether a specific access flag is set
has
(AccessFlag
the access flag
flag
)

Returns whether a specific access flag is set.

public ClassEntry

Returns:

the nested class described by this entry
innerClass
()

Returns the nested class described by this entry.

public Optional<Utf8Entry>

Returns:

the simple name of this class, or empty if this class is anonymous
innerName
()

Returns the simple name of this class, or empty if this class is anonymous.

public static InnerClassInfo

Returns:

a nested class description
of
(ClassEntry
the nested class being described
innerClass
,
Optional<ClassEntry>
the class that has the nested class as a member, if it exists
outerClass
,
Optional<Utf8Entry>
the simple name of the nested class, if it is not anonymous
innerName
,
int
the inner class access flags
flags
)

Returns a nested class description.

public static InnerClassInfo

Returns:

a nested class description
of
(ClassDesc
the nested class being described
innerClass
,
Optional<ClassDesc>
the class that has the nested class as a member, if it exists
outerClass
,
Optional<String>
the simple name of the nested class, if it is not anonymous
innerName
,
int
the inner class access flags
flags
)

Returns a nested class description.

public static InnerClassInfo

Returns:

a nested class description
of
(ClassDesc
the nested class being described
innerClass
,
Optional<ClassDesc>
the class that has the nested class as a member, if it exists
outerClass
,
Optional<String>
the name of the nested class, if it is not anonymous
innerName
,
AccessFlag...
the inner class access flags
flags
)

Returns a nested class description.

public Optional<ClassEntry>

Returns:

the class or interface of which this class is a member, if it is a member of a class or interface
outerClass
()

Returns the class or interface of which this class is a member, if it is a member of a class or interface.

Method Detail

flagsback to summary
public default Set<AccessFlag> flags()

Returns a set of flag enums denoting access permissions and properties of the nested class.

Returns:Set<AccessFlag>

a set of flag enums denoting access permissions and properties of the nested class

Exceptions
IllegalArgumentException:
if the flags mask has any undefined bit set
See Also
Class#accessFlags(), AccessFlag.Location#INNER_CLASS
flagsMaskback to summary
public int flagsMask()

Returns a bit mask of flags denoting access permissions and properties of the inner class. It is a u2 value.

Returns:int

a bit mask of flags denoting access permissions and properties of the inner class

See Also
Class#getModifiers(), AccessFlag.Location#INNER_CLASS
hasback to summary
public default boolean has(AccessFlag flag)

Returns whether a specific access flag is set.

Parameters
flag:AccessFlag

the access flag

Returns:boolean

whether a specific access flag is set

See Also
AccessFlag.Location#INNER_CLASS
innerClassback to summary
public ClassEntry innerClass()

Returns the nested class described by this entry.

Returns:ClassEntry

the nested class described by this entry

innerNameback to summary
public Optional<Utf8Entry> innerName()

Returns the simple name of this class, or empty if this class is anonymous.

Returns:Optional<Utf8Entry>

the simple name of this class, or empty if this class is anonymous

See Also
Class#getSimpleName()
ofback to summary
public static InnerClassInfo of(ClassEntry innerClass, Optional<ClassEntry> outerClass, Optional<Utf8Entry> innerName, int flags)

Returns a nested class description.

Parameters
innerClass:ClassEntry

the nested class being described

outerClass:Optional<ClassEntry>

the class that has the nested class as a member, if it exists

innerName:Optional<Utf8Entry>

the simple name of the nested class, if it is not anonymous

flags:int

the inner class access flags

Returns:InnerClassInfo

a nested class description

Exceptions
IllegalArgumentException:
if flags is not u2
ofback to summary
public static InnerClassInfo of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, int flags)

Returns a nested class description.

Parameters
innerClass:ClassDesc

the nested class being described

outerClass:Optional<ClassDesc>

the class that has the nested class as a member, if it exists

innerName:Optional<String>

the simple name of the nested class, if it is not anonymous

flags:int

the inner class access flags

Returns:InnerClassInfo

a nested class description

Exceptions
IllegalArgumentException:
if innerClass or outerClass represents a primitive type, or if flags is not u2
ofback to summary
public static InnerClassInfo of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, AccessFlag... flags)

Returns a nested class description.

Parameters
innerClass:ClassDesc

the nested class being described

outerClass:Optional<ClassDesc>

the class that has the nested class as a member, if it exists

innerName:Optional<String>

the name of the nested class, if it is not anonymous

flags:AccessFlag[]

the inner class access flags

Returns:InnerClassInfo

a nested class description

Exceptions
IllegalArgumentException:
if innerClass or outerClass represents a primitive type, or if any flag cannot be applied to the AccessFlag.Location#INNER_CLASS location
outerClassback to summary
public Optional<ClassEntry> outerClass()

Returns the class or interface of which this class is a member, if it is a member of a class or interface. This may be empty if this class is local or anonymous.

Returns:Optional<ClassEntry>

the class or interface of which this class is a member, if it is a member of a class or interface

See Also
Class#getDeclaringClass()