Module jakarta.cdi.lang.model
Interface DeclarationInfo
- All Superinterfaces:
AnnotationTarget
- All Known Subinterfaces:
ClassInfo
,FieldInfo
,MethodInfo
,PackageInfo
,ParameterInfo
,RecordComponentInfo
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
- record components
- Since:
- 4.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The declaration kind: package, class, method, parameter, field, record component. -
Method Summary
Modifier and TypeMethodDescriptiondefault ClassInfo
asClass()
Returns this declaration as a class.default DeclarationInfo
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
Returns this declaration as a package.default ParameterInfo
Returns this declaration as a method parameter.default RecordComponentInfo
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
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
Returns whether this declaration is a package.default boolean
Returns whether this declaration is a method parameter.default boolean
Returns whether this declaration is a record component.default boolean
isType()
Returns whether this annotation target is a type.kind()
Returns the kind of this declaration.Methods inherited from interface jakarta.enterprise.lang.model.AnnotationTarget
annotation, annotations, annotations, hasAnnotation, hasAnnotation, repeatableAnnotation
-
Method Details
-
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
Description copied from interface:AnnotationTarget
Returns this annotation target as a declaration.- Specified by:
asDeclaration
in interfaceAnnotationTarget
- Returns:
- this declaration, never
null
-
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
Returns this declaration as a package.- Returns:
- this package, never
null
- Throws:
IllegalStateException
- ifisPackage()
returnsfalse
-
asClass
Returns this declaration as a class.- Returns:
- this class, never
null
- Throws:
IllegalStateException
- ifisClass()
returnsfalse
-
asMethod
Returns this declaration as a method.- Returns:
- this method, never
null
- Throws:
IllegalStateException
- ifisMethod()
returnsfalse
-
asParameter
Returns this declaration as a method parameter.- Returns:
- this parameter, never
null
- Throws:
IllegalStateException
- ifisParameter()
returnsfalse
-
asField
Returns this declaration as a field.- Returns:
- this field, never
null
- Throws:
IllegalStateException
- ifisField()
returnsfalse
-
asRecordComponent
Returns this declaration as a record component.- Returns:
- this record component, never
null
- Throws:
IllegalStateException
- ifisRecordComponent()
returnsfalse
-