- All Superinterfaces:
AttributedElement,ClassFileElement,CompoundElement<ClassElement>,Iterable<ClassElement>
- All Known Implementing Classes:
ClassImpl
public sealed interface ClassModel
extends CompoundElement<ClassElement>, AttributedElement
permits ClassImpl
Models a classfile. The contents of the classfile can be traversed via
a streaming view (e.g.,
CompoundElement.elements()), or via random access (e.g.,
flags()), or by freely mixing the two.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionReturns the constant pool for this class.fields()Returns the fields of this class.flags()Returns the access flags.Returns the interfaces implemented by this class.booleanReturns whether this class is a module descriptor.intReturns the major classfile version.methods()Returns the methods of this class.intReturns the minor classfile version.Returns the superclass of this class, if there is one.Returns the constant pool entry describing the name of this class.Methods inherited from interface org.glavo.classfile.AttributedElement
attributes, findAttribute, findAttributesMethods inherited from interface org.glavo.classfile.CompoundElement
elementList, elements, elementStream, forEachElement, iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
constantPool
ConstantPool constantPool()Returns the constant pool for this class.- Returns:
- the constant pool for this class
-
flags
AccessFlags flags()Returns the access flags.- Returns:
- the access flags
-
thisClass
ClassEntry thisClass()Returns the constant pool entry describing the name of this class.- Returns:
- the constant pool entry describing the name of this class
-
majorVersion
int majorVersion()Returns the major classfile version.- Returns:
- the major classfile version
-
minorVersion
int minorVersion()Returns the minor classfile version.- Returns:
- the minor classfile version
-
fields
List<FieldModel> fields()Returns the fields of this class.- Returns:
- the fields of this class
-
methods
List<MethodModel> methods()Returns the methods of this class.- Returns:
- the methods of this class
-
superclass
Optional<ClassEntry> superclass()Returns the superclass of this class, if there is one.- Returns:
- the superclass of this class, if there is one
-
interfaces
List<ClassEntry> interfaces()Returns the interfaces implemented by this class.- Returns:
- the interfaces implemented by this class
-
isModuleInfo
boolean isModuleInfo()Returns whether this class is a module descriptor.- Returns:
- whether this class is a module descriptor
-