Top Fields Constructors Methods
jdk.internal.classfile.impl

public final Class ClassImpl

extends AbstractElement
implements ClassModel
Class Inheritance
All Implemented Interfaces
java.lang.classfile.ClassModel, java.lang.classfile.AttributedElement, java.lang.classfile.ClassFileElement, java.lang.classfile.CompoundElement, java.lang.Iterable
Imports
java.util.List, .Optional, java.util.function.Consumer, java.lang.classfile.constantpool.ClassEntry, .ConstantPool, java.lang.reflect.AccessFlag, java.lang.classfile.AccessFlags, .Attribute, .Attributes, .ClassElement, .ClassModel, .ClassFile, .ClassFileVersion, .CustomAttribute, .FieldModel, .Interfaces, .MethodModel, .Superclass, java.lang.classfile.attribute.InnerClassesAttribute, .ModuleAttribute, .ModuleHashesAttribute, .ModuleMainClassAttribute, .ModulePackagesAttribute, .ModuleResolutionAttribute, .ModuleTargetAttribute, .RuntimeInvisibleAnnotationsAttribute, .RuntimeVisibleAnnotationsAttribute, .SourceDebugExtensionAttribute, .SourceFileAttribute, jdk.internal.access.SharedSecrets

Field Summary

Modifier and TypeField and Description
private List<Attribute<?>>
private final int
private final List<FieldModel>
private List<ClassEntry>
private final List<MethodModel>
pack-priv final ClassReaderImpl

Constructor Summary

AccessConstructor and Description
public
ClassImpl(byte[] cfbytes, ClassFileImpl context)

Method Summary

Modifier and TypeMethod and Description
public List<Attribute<?>>
attributes()

Implements java.lang.classfile.AttributedElement.attributes.

Returns the attributes of this element.

public int
public ConstantPool
constantPool()

Implements java.lang.classfile.ClassModel.constantPool.

Returns the constant pool for this class.

public List<FieldModel>
fields()

Implements java.lang.classfile.ClassModel.fields.

Returns the fields of this class.

public AccessFlags
flags()

Implements java.lang.classfile.ClassModel.flags.

Returns the access flags.

public void
forEachElement(Consumer<ClassElement>
the handler
consumer
)

Implements java.lang.classfile.CompoundElement.forEachElement.

Invoke the provided handler with each element contained in this compound element

public List<ClassEntry>
interfaces()

Implements java.lang.classfile.ClassModel.interfaces.

Returns the interfaces implemented by this class.

public boolean
isModuleInfo()

Implements java.lang.classfile.ClassModel.isModuleInfo.

Returns whether this class is a module descriptor.

public int
majorVersion()

Implements java.lang.classfile.ClassModel.majorVersion.

Returns the major classfile version.

public List<MethodModel>
methods()

Implements java.lang.classfile.ClassModel.methods.

Returns the methods of this class.

public int
minorVersion()

Implements java.lang.classfile.ClassModel.minorVersion.

Returns the minor classfile version.

public Optional<ClassEntry>
superclass()

Implements java.lang.classfile.ClassModel.superclass.

Returns the superclass of this class, if there is one.

public ClassEntry
thisClass()

Implements java.lang.classfile.ClassModel.thisClass.

Returns the constant pool entry describing the name of this class.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private boolean
Inherited from jdk.internal.classfile.impl.AbstractElement:
writeTowriteTowriteTowriteTo

Field Detail

attributesback to summary
private List<Attribute<?>> attributes
attributesPosback to summary
private final int attributesPos
fieldsback to summary
private final List<FieldModel> fields
interfacesback to summary
private List<ClassEntry> interfaces
methodsback to summary
private final List<MethodModel> methods
readerback to summary
pack-priv final ClassReaderImpl reader

Constructor Detail

ClassImplback to summary
public ClassImpl(byte[] cfbytes, ClassFileImpl context)

Method Detail

attributesback to summary
public List<Attribute<?>> attributes()

Implements java.lang.classfile.AttributedElement.attributes.

Doc from java.lang.classfile.AttributedElement.attributes.

Returns the attributes of this element.

Returns:List<Attribute<?>>

the attributes of this element

Annotations
@Override
classfileLengthback to summary
public int classfileLength()
constantPoolback to summary
public ConstantPool constantPool()

Implements java.lang.classfile.ClassModel.constantPool.

Doc from java.lang.classfile.ClassModel.constantPool.

Returns the constant pool for this class.

Returns:ConstantPool

the constant pool for this class

Annotations
@Override
fieldsback to summary
public List<FieldModel> fields()

Implements java.lang.classfile.ClassModel.fields.

Doc from java.lang.classfile.ClassModel.fields.

Returns the fields of this class.

Returns:List<FieldModel>

the fields of this class

Annotations
@Override
flagsback to summary
public AccessFlags flags()

Implements java.lang.classfile.ClassModel.flags.

Doc from java.lang.classfile.ClassModel.flags.

Returns the access flags.

Returns:AccessFlags

the access flags

Annotations
@Override
forEachElementback to summary
public void forEachElement(Consumer<ClassElement> consumer)

Implements java.lang.classfile.CompoundElement.forEachElement.

Doc from java.lang.classfile.CompoundElement.forEachElement.

Invoke the provided handler with each element contained in this compound element

Parameters
consumer:Consumer<ClassElement>

the handler

Annotations
@Override
interfacesback to summary
public List<ClassEntry> interfaces()

Implements java.lang.classfile.ClassModel.interfaces.

Doc from java.lang.classfile.ClassModel.interfaces.

Returns the interfaces implemented by this class.

Returns:List<ClassEntry>

the interfaces implemented by this class

Annotations
@Override
isModuleInfoback to summary
public boolean isModuleInfo()

Implements java.lang.classfile.ClassModel.isModuleInfo.

Doc from java.lang.classfile.ClassModel.isModuleInfo.

Returns whether this class is a module descriptor.

Returns:boolean

whether this class is a module descriptor

Annotations
@Override
majorVersionback to summary
public int majorVersion()

Implements java.lang.classfile.ClassModel.majorVersion.

Doc from java.lang.classfile.ClassModel.majorVersion.

Returns the major classfile version.

Returns:int

the major classfile version

Annotations
@Override
methodsback to summary
public List<MethodModel> methods()

Implements java.lang.classfile.ClassModel.methods.

Doc from java.lang.classfile.ClassModel.methods.

Returns the methods of this class.

Returns:List<MethodModel>

the methods of this class

Annotations
@Override
minorVersionback to summary
public int minorVersion()

Implements java.lang.classfile.ClassModel.minorVersion.

Doc from java.lang.classfile.ClassModel.minorVersion.

Returns the minor classfile version.

Returns:int

the minor classfile version

Annotations
@Override
superclassback to summary
public Optional<ClassEntry> superclass()

Implements java.lang.classfile.ClassModel.superclass.

Doc from java.lang.classfile.ClassModel.superclass.

Returns the superclass of this class, if there is one.

Returns:Optional<ClassEntry>

the superclass of this class, if there is one

Annotations
@Override
thisClassback to summary
public ClassEntry thisClass()

Implements java.lang.classfile.ClassModel.thisClass.

Doc from java.lang.classfile.ClassModel.thisClass.

Returns the constant pool entry describing the name of this class.

Returns:ClassEntry

the constant pool entry describing the name of this class

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
verifyModuleAttributesback to summary
private boolean verifyModuleAttributes()