Module jakarta.cdi.lang.model
Interface DeclarationInfo
-
- All Superinterfaces:
AnnotationTarget
- All Known Subinterfaces:
ClassInfo
,FieldInfo
,MethodInfo
,PackageInfo
,ParameterInfo
,RecordComponentInfo
public interface DeclarationInfo extends AnnotationTarget
A declaration is an element of a program source code. Declarations are:- packages
- classes, including interfaces, enums, annotations, and records
- fields
- methods, including constructors
- method parameters, including constructor parameters
- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DeclarationInfo.Kind
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ClassInfo
asClass()
Returns this declaration as a class.default DeclarationInfo
asDeclaration()
Returns this annotation target as a declaration.default FieldInfo
asField()
Returns this declaration as a field.default MethodInfo
asMethod()
Returns this declaration as a method.default PackageInfo
asPackage()
Returns this declaration as a package.default ParameterInfo
asParameter()
Returns this declaration as a method parameter.default RecordComponentInfo
asRecordComponent()
Returns this declaration as a record component.default Type
asType()
Returns this annotation target as a type.default boolean
isClass()
Returns whether this declaration is a class.default boolean
isDeclaration()
Returns whether this annotation target is a declaration.default boolean
isField()
Returns whether this declaration is a field.default boolean
isMethod()
Returns whether this declaration is a method.default boolean
isPackage()
Returns whether this declaration is a package.default boolean
isParameter()
Returns whether this declaration is a method parameter.default boolean
isRecordComponent()
Returns whether this declaration is a record component.default boolean
isType()
Returns whether this annotation target is a type.DeclarationInfo.Kind
kind()
Returns the kind of this declaration.-
Methods inherited from interface jakarta.enterprise.lang.model.AnnotationTarget
annotation, annotations, annotations, hasAnnotation, hasAnnotation, repeatableAnnotation
-
-
-
-
Method Detail
-
isDeclaration
default boolean isDeclaration()
Description copied from interface:AnnotationTarget
Returns whether this annotation target is a declaration.- Specified by:
isDeclaration
in interfaceAnnotationTarget
- Returns:
true
if this is a declaration,false
otherwise
-
isType
default boolean isType()
Description copied from interface:AnnotationTarget
Returns whether this annotation target is a type.- Specified by:
isType
in interfaceAnnotationTarget
- Returns:
true
if this is a type,false
otherwise
-
asDeclaration
default DeclarationInfo asDeclaration()
Description copied from interface:AnnotationTarget
Returns this annotation target as a declaration.- Specified by:
asDeclaration
in interfaceAnnotationTarget
- Returns:
- this declaration, never
null
-
asType
default Type asType()
Description copied from interface:AnnotationTarget
Returns this annotation target as a type.- Specified by:
asType
in interfaceAnnotationTarget
- Returns:
- this type, never
null
-
kind
DeclarationInfo.Kind kind()
Returns the kind of this declaration.- Returns:
- the kind of this declaration
-
isPackage
default boolean isPackage()
Returns whether this declaration is a package.- Returns:
true
if this is a package,false
otherwise
-
isClass
default boolean isClass()
Returns whether this declaration is a class.- Returns:
true
if this is a class,false
otherwise
-
isMethod
default boolean isMethod()
Returns whether this declaration is a method.- Returns:
true
if this is a method,false
otherwise
-
isParameter
default boolean isParameter()
Returns whether this declaration is a method parameter.- Returns:
true
if this is a parameter,false
otherwise
-
isField
default boolean isField()
Returns whether this declaration is a field.- Returns:
true
if this is a field,false
otherwise
-
isRecordComponent
default boolean isRecordComponent()
Returns whether this declaration is a record component.- Returns:
true
if this is a record component,false
otherwise
-
asPackage
default PackageInfo asPackage()
Returns this declaration as a package.- Returns:
- this package, never
null
- Throws:
java.lang.IllegalStateException
- ifisPackage()
returnsfalse
-
asClass
default ClassInfo asClass()
Returns this declaration as a class.- Returns:
- this class, never
null
- Throws:
java.lang.IllegalStateException
- ifisClass()
returnsfalse
-
asMethod
default MethodInfo asMethod()
Returns this declaration as a method.- Returns:
- this method, never
null
- Throws:
java.lang.IllegalStateException
- ifisMethod()
returnsfalse
-
asParameter
default ParameterInfo asParameter()
Returns this declaration as a method parameter.- Returns:
- this parameter, never
null
- Throws:
java.lang.IllegalStateException
- ifisParameter()
returnsfalse
-
asField
default FieldInfo asField()
Returns this declaration as a field.- Returns:
- this field, never
null
- Throws:
java.lang.IllegalStateException
- ifisField()
returnsfalse
-
asRecordComponent
default RecordComponentInfo asRecordComponent()
Returns this declaration as a record component.- Returns:
- this record component, never
null
- Throws:
java.lang.IllegalStateException
- ifisRecordComponent()
returnsfalse
-
-