Module java.base
Package java.lang.classfile

# Interface ClassModel

≠
public abstract sealed interface ClassModel
extends java.lang.classfile.AttributedElement, java.lang.classfile.CompoundElement<java.lang.classfile.ClassElement>
permits jdk.internal.classfile.impl.ClassImpl
Comparing jdk-master and valhalla-csr-open

All Superinterfaces:
  `AttributedElement, ClassFileElement, CompoundElement<ClassElementPREVIEW >, Iterable<ClassElementPREVIEW >`

public sealed interface ClassModel extends CompoundElement<ClassElementPREVIEW >, AttributedElement
Models a `class` file. A `class` file can be viewed as a composition of `ClassElement` PREVIEW s, or by random access via accessor methods if only specific parts of the `class` file is needed.

Use `ClassFile.parse(byte[])` , which parses the binary data of a `class` file into a model, to obtain a `ClassModel` .

To construct a `class` file, use `ClassFile.build(ClassDesc, Consumer)` . `ClassFile.transformClass(ClassModel, ClassTransform)` allows creating a new class by selectively processing the original class elements and directing the results to a class builder.

A class holds attributes, most of which are accessible as member elements. `BootstrapMethodsAttribute` can only be accessed via explicit attribute reading, as it is modeled as part of the constant pool.

See Java Virtual Machine Specification:
  4.1 The `ClassFile` Structure
Since:
  24
See Also:
  - `ClassFile.parse(byte[])`
  - `ClassTransform`

## Methods

- =
  public abstract java.lang.classfile.constantpool.ConstantPool constantPool()
- =
  public abstract java.util.List<java.lang.classfile.FieldModel> fields()
- =
  public abstract java.lang.classfile.AccessFlags flags()
- =
  public abstract java.util.List<java.lang.classfile.constantpool.ClassEntry> interfaces()
- =
  public abstract boolean isModuleInfo()
- =
  public abstract int majorVersion()
- =
  public abstract java.util.List<java.lang.classfile.MethodModel> methods()
- =
  public abstract int minorVersion()
- =
  public abstract java.util.Optional<java.lang.classfile.constantpool.ClassEntry> superclass()
- =
  public abstract java.lang.classfile.constantpool.ClassEntry thisClass()

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
ClassModel |  |  |  |  |  |  | 4 |  |  | 4
Total |  |  |  |  |  |  | 4 |  |  | 4