Top Description Methods
jakarta.enterprise.lang.model.declarations

public Interface ClassInfo

extends DeclarationInfo
Imports
java.util.Collection, .List, jakarta.enterprise.lang.model.types.Type, .TypeVariable

A class. Five kinds of classes are distinguished: Classes are represented as isolated units. That is, if this class is nested, it is not possible to obtain the enclosing class. Similarly, it is not possible to obtain the set of classes nested in this class.

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

Method Summary

Modifier and TypeMethod and Description
public default ClassInfo
asClass()

Overrides default jakarta.enterprise.lang.model.declarations.DeclarationInfo.asClass.

Returns this declaration as a class.

public Collection<MethodInfo>

Returns:

immutable collection of constructors, never null
constructors
()

Returns a collection of constructors declared or implicitly declared in this class.

public Collection<FieldInfo>

Returns:

immutable collection of fields, never null
fields
()

Returns a collection of fields declared or implicitly declared in this class and all its superclasses up to and excluding java.lang.Object, as well as all direct and indirect superinterfaces.

public boolean

Returns:

whether this class is abstract
isAbstract
()

Returns whether this class is abstract.

public boolean

Returns:

whether this class is an annotation
isAnnotation
()

Returns whether this class is an annotation.

public boolean

Returns:

whether this class is an enum
isEnum
()

Returns whether this class is an enum.

public boolean

Returns:

whether this class is final
isFinal
()

Returns whether this class is final.

public boolean

Returns:

whether this class is an interface
isInterface
()

Returns whether this class is an interface.

public boolean

Returns:

whether this class is a plain class
isPlainClass
()

Returns whether this class is a plain class.

public boolean

Returns:

whether this class is a record
isRecord
()

Returns whether this class is a record.

public default DeclarationInfo.Kind
kind()

Implements jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Returns the kind of this declaration.

public Collection<MethodInfo>

Returns:

immutable collection of methods, never null
methods
()

Returns a collection of methods declared or implicitly declared in this class and all its superclasses up to and excluding java.lang.Object, as well as all direct and indirect superinterfaces.

public int

Returns:

the modifiers of this class
modifiers
()

Returns the modifiers of this class as an int.

public String

Returns:

binary name of this class, never null
name
()

Returns the binary name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned by Class#getName().

public PackageInfo

Returns:

this class's package, or null if this class is in an unnamed package
packageInfo
()

Returns the package this class is part of.

public Collection<RecordComponentInfo>

Returns:

immutable collection of record components, never nul
recordComponents
()

Returns a collection of record components declared in this class.

public String

Returns:

simple name of this class, never null
simpleName
()

Returns the simple name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned by Class#getSimpleName().

public Type

Returns:

the direct superclass type of this class, or null if there's no superclass
superClass
()

Returns the direct superclass type of this class.

public ClassInfo

Returns:

the direct superclass of this class, or null if there's no superclass
superClassDeclaration
()

Returns the direct superclass of this class.

public List<Type>

Returns:

immutable list of direct superinterface types of this class, never null
superInterfaces
()

Returns a list of direct superinterface types of this class.

public List<ClassInfo>

Returns:

immutable list of direct superinterfaces of this class, never null
superInterfacesDeclarations
()

Returns a list of direct superinterfaces of this class.

public List<TypeVariable>

Returns:

immutable list of this class's type parameters, never null
typeParameters
()

Returns a list of type parameters declared on this class.

Inherited from jakarta.enterprise.lang.model.declarations.DeclarationInfo:
asDeclarationasFieldasMethodasPackageasParameterasRecordComponentasTypeisClassisDeclarationisFieldisMethodisPackageisParameterisRecordComponentisType

Method Detail

asClassback to summary
public default ClassInfo asClass()

Overrides default jakarta.enterprise.lang.model.declarations.DeclarationInfo.asClass.

Doc from jakarta.enterprise.lang.model.declarations.DeclarationInfo.asClass.

Returns this declaration as a class.

Returns:ClassInfo

this class, never null

Annotations
@Override
constructorsback to summary
public Collection<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:Collection<MethodInfo>

immutable collection of constructors, never null

fieldsback to summary
public Collection<FieldInfo> fields()

Returns a collection of fields declared or implicitly declared in this class and all its superclasses up to and excluding java.lang.Object, as well as all direct and indirect superinterfaces. If this class is java.lang.Object, its fields are not excluded. 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.declaringClass should be used to distinguish such fields

Iteration order of the resulting collection is not defined and does not have to correspond to the inheritance hierarchy of this class.

Returns:Collection<FieldInfo>

immutable collection of fields, never null

isAbstractback to summary
public boolean isAbstract()

Returns whether this class is abstract.

A plain class is abstract if declared abstract. An enum is abstract if it declares abstract methods. An interface or an annotation is always abstract. A record is never abstract.

Returns:boolean

whether this class is abstract

isAnnotationback to summary
public boolean isAnnotation()

Returns whether this class is an annotation.

Returns:boolean

whether this class is an annotation

isEnumback to summary
public boolean isEnum()

Returns whether this class is an enum.

Returns:boolean

whether this class is an enum

isFinalback to summary
public boolean isFinal()

Returns whether this class is final.

Returns:boolean

whether this class is final

isInterfaceback to summary
public boolean isInterface()

Returns whether this class is an interface. If this class is an annotation, returns false.

Returns:boolean

whether this class is an interface

isPlainClassback to summary
public boolean 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:boolean

whether this class is a plain class

isRecordback to summary
public boolean isRecord()

Returns whether this class is a record.

Returns:boolean

whether this class is a record

kindback to summary
public default DeclarationInfo.Kind kind()

Implements jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Doc from jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Returns the kind of this declaration.

Returns:DeclarationInfo.Kind

the kind of this declaration

Annotations
@Override
methodsback to summary
public Collection<MethodInfo> methods()

Returns a collection of methods declared or implicitly declared in this class and all its superclasses up to and excluding java.lang.Object, as well as all direct and indirect superinterfaces. If this class is java.lang.Object, its methods are not excluded. If this class is an interface, only superinterfaces are considered. Implicitly declared methods corresponding to java.lang.Object methods in interfaces are omitted.

If the collection of methods described above contains multiple methods with the same signature, all such methods are returned. MethodInfo.declaringClass should 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:Collection<MethodInfo>

immutable collection of methods, never null

modifiersback to summary
public int modifiers()

Returns the modifiers of this class as an int. Use Modifier to inspect the value.

Returns:int

the modifiers of this class

nameback to summary
public String name()

Returns the binary name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned by Class#getName().

Returns:String

binary name of this class, never null

packageInfoback to summary
public PackageInfo packageInfo()

Returns the package this class is part of. Returns null if this class is part of an unnamed package.

Returns:PackageInfo

this class's package, or null if this class is in an unnamed package

recordComponentsback to summary
public Collection<RecordComponentInfo> recordComponents()

Returns a collection of record components declared in this class. If this class is not a record, returns an empty collection.

Returns:Collection<RecordComponentInfo>

immutable collection of record components, never nul

simpleNameback to summary
public String simpleName()

Returns the simple name of this class, as defined by The Java™ Language Specification; in other words, the class name as returned by Class#getSimpleName().

Returns:String

simple name of this class, never null

superClassback to summary
public Type superClass()

Returns the direct superclass type of this class. Returns null if this class does not have a superclass; that is, if this class is java.lang.Object or an interface.

Returns:Type

the direct superclass type of this class, or null if there's no superclass

superClassDeclarationback to summary
public ClassInfo superClassDeclaration()

Returns the direct superclass of this class. Returns null if this class does not have a superclass; that is, if this class is java.lang.Object or an interface.

Returns:ClassInfo

the direct superclass of this class, or null if there's no superclass

superInterfacesback to summary
public List<Type> superInterfaces()

Returns a list of direct superinterface types of this class. Returns an empty list if this class has no direct superinterface.

Returns:List<Type>

immutable list of direct superinterface types of this class, never null

superInterfacesDeclarationsback to summary
public List<ClassInfo> superInterfacesDeclarations()

Returns a list of direct superinterfaces of this class. Returns an empty list if this class has no direct superinterface.

Returns:List<ClassInfo>

immutable list of direct superinterfaces of this class, never null

typeParametersback to summary
public List<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:List<TypeVariable>

immutable list of this class's type parameters, never null