Interface ClassInfo
- 
- All Superinterfaces:
- AnnotationTarget,- DeclarationInfo
 
 public interface ClassInfo extends DeclarationInfo A class. Five kinds of classes are distinguished:- plain classes
- interfaces
- enums (restricted kind of classes)
- annotations (specialized kind of interfaces)
- records (restricted kind of classes)
 At the same time, it is possible to obtain the set of constructors, methods and fields declared in this class, as well as the set of record components if this class is a record. It is also possible to obtain the package this class is declared in. - Since:
- 4.0
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface jakarta.enterprise.lang.model.declarations.DeclarationInfoDeclarationInfo.Kind
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ClassInfoasClass()Returns this declaration as a class.Collection<MethodInfo>constructors()Returns a collection of constructors declared or implicitly declared in this class.Collection<FieldInfo>fields()Returns a collection of fields declared or implicitly declared in this class and all its superclasses up to and excludingjava.lang.Object, as well as all direct and indirect superinterfaces.booleanisAbstract()Returns whether this class is abstract.booleanisAnnotation()Returns whether this class is an annotation.booleanisEnum()Returns whether this class is an enum.booleanisFinal()Returns whether this class isfinal.booleanisInterface()Returns whether this class is an interface.booleanisPlainClass()Returns whether this class is a plain class.booleanisRecord()Returns whether this class is a record.default DeclarationInfo.Kindkind()Returns the kind of this declaration.Collection<MethodInfo>methods()Returns a collection of methods declared or implicitly declared in this class and all its superclasses up to and excludingjava.lang.Object, as well as all direct and indirect superinterfaces.intmodifiers()Returns the modifiers of this class as anint.Stringname()Returns the binary name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned byClass.getName().PackageInfopackageInfo()Returns the package this class is part of.Collection<RecordComponentInfo>recordComponents()Returns a collection of record components declared in this class.StringsimpleName()Returns the simple name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned byClass.getSimpleName().TypesuperClass()Returns the type of this class's superclass.ClassInfosuperClassDeclaration()Returns the declaration of this class's superclass.List<Type>superInterfaces()Returns a list of types of this class's direct superinterfaces.List<ClassInfo>superInterfacesDeclarations()Returns a list of declarations of this class's direct superinterfaces.List<TypeVariable>typeParameters()Returns a list of type parameters declared on this class.- 
Methods inherited from interface jakarta.enterprise.lang.model.AnnotationTargetannotation, annotations, annotations, hasAnnotation, hasAnnotation, repeatableAnnotation
 - 
Methods inherited from interface jakarta.enterprise.lang.model.declarations.DeclarationInfoasDeclaration, asField, asMethod, asPackage, asParameter, asRecordComponent, asType, isClass, isDeclaration, isField, isMethod, isPackage, isParameter, isRecordComponent, isType
 
- 
 
- 
- 
- 
Method Detail- 
nameString name() Returns the binary name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned byClass.getName().- Returns:
- binary name of this class, never null
 
 - 
simpleNameString simpleName() Returns the simple name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned byClass.getSimpleName().- Returns:
- simple name of this class, never null
 
 - 
packageInfoPackageInfo packageInfo() Returns the package this class is part of. Returnsnullif this class is part of an unnamed package.- Returns:
- this class's package, or nullif this class is in an unnamed package
 
 - 
typeParametersList<TypeVariable> typeParameters() Returns a list of type parameters declared on this class. Returns an empty list if this class is not generic and so does not declare type parameters.- Returns:
- immutable list of this class's type parameters, never null
 
 - 
superClassType superClass() Returns the type of this class's superclass. Returnsnullif this class does not have a superclass; that is, if this class isjava.lang.Objector an interface.- Returns:
- the type of this class's superclass, or nullif there's no superclass
 
 - 
superClassDeclarationClassInfo superClassDeclaration() Returns the declaration of this class's superclass. Returnsnullif this class does not have a superclass; that is, if this class isjava.lang.Objector an interface.- Returns:
- the declaration of this class's superclass, or nullif there's no superclass
 
 - 
superInterfacesList<Type> superInterfaces() Returns a list of types of this class's direct superinterfaces. Returns an empty list if this class has no direct superinterface.- Returns:
- immutable list of types of this class's direct superinterfaces, never null
 
 - 
superInterfacesDeclarationsList<ClassInfo> superInterfacesDeclarations() Returns a list of declarations of this class's direct superinterfaces. Returns an empty list if this class has no direct superinterface.- Returns:
- immutable list of declarations of this class's direct superinterfaces, never null
 
 - 
isPlainClassboolean isPlainClass() Returns whether this class is a plain class. That is, not an interface, not an enum, not an annotation, and not a record.- Returns:
- whether this class is a plain class
 
 - 
isInterfaceboolean isInterface() Returns whether this class is an interface. If this class is an annotation, returnsfalse.- Returns:
- whether this class is an interface
 
 - 
isEnumboolean isEnum() Returns whether this class is an enum.- Returns:
- whether this class is an enum
 
 - 
isAnnotationboolean isAnnotation() Returns whether this class is an annotation.- Returns:
- whether this class is an annotation
 
 - 
isRecordboolean isRecord() Returns whether this class is a record.- Returns:
- whether this class is a record
 
 - 
isAbstractboolean isAbstract() Returns whether this class is abstract.A plain class is abstract if declared abstract. An enum is abstract if it declaresabstractmethods. An interface or an annotation is always abstract. A record is never abstract.- Returns:
- whether this class is abstract
 
 - 
isFinalboolean isFinal() Returns whether this class isfinal.- Returns:
- whether this class is final
 
 - 
modifiersint modifiers() Returns the modifiers of this class as anint. UseModifierto inspect the value.- Returns:
- the modifiers of this class
 
 - 
constructorsCollection<MethodInfo> constructors() Returns a collection of constructors declared or implicitly declared in this class. Constructors declared in direct or indirect superclasses are not included.If this class is an interface or an annotation, returns an empty collection. - Returns:
- immutable collection of constructors, never null
 
 - 
methodsCollection<MethodInfo> methods() Returns a collection of methods declared or implicitly declared in this class and all its superclasses up to and excludingjava.lang.Object, as well as all direct and indirect superinterfaces. If this class is an interface, only superinterfaces are considered. Methods implicitly declared in interfaces are omitted.If the collection of methods described above contains multiple methods with the same signature, all such methods are returned. MethodInfo.declaringClassshould be used to distinguish such methods.Iteration order of the resulting collection is not defined and does not have to correspond to the inheritance hierarchy of this class. - Returns:
- immutable collection of methods, never null
 
 - 
fieldsCollection<FieldInfo> fields() Returns a collection of fields declared or implicitly declared in this class and all its superclasses up to and excludingjava.lang.Object, as well as all direct and indirect superinterfaces. If this class is an interface, only superinterfaces are considered.If the collection of fields described above contains multiple fields with the same name, all such fields are returned. FieldInfo.declaringClassshould be used to distinguish such fieldsIteration order of the resulting collection is not defined and does not have to correspond to the inheritance hierarchy of this class. - Returns:
- immutable collection of fields, never null
 
 - 
recordComponentsCollection<RecordComponentInfo> recordComponents() Returns a collection of record components declared in this class. If this class is not a record, returns an empty collection.- Returns:
- immutable collection of record components, never nul
 
 - 
kinddefault DeclarationInfo.Kind kind() Description copied from interface:DeclarationInfoReturns the kind of this declaration.- Specified by:
- kindin interface- DeclarationInfo
- Returns:
- the kind of this declaration
 
 - 
asClassdefault ClassInfo asClass() Description copied from interface:DeclarationInfoReturns this declaration as a class.- Specified by:
- asClassin interface- DeclarationInfo
- Returns:
- this class, never null
 
 
- 
 
-