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 classDeclarationInfo.Kind 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ClassInfoasClass()Returns this declaration as a class.default DeclarationInfoasDeclaration()Returns this annotation target as a declaration.default FieldInfoasField()Returns this declaration as a field.default MethodInfoasMethod()Returns this declaration as a method.default PackageInfoasPackage()Returns this declaration as a package.default ParameterInfoasParameter()Returns this declaration as a method parameter.default RecordComponentInfoasRecordComponent()Returns this declaration as a record component.default TypeasType()Returns this annotation target as a type.default booleanisClass()Returns whether this declaration is a class.default booleanisDeclaration()Returns whether this annotation target is a declaration.default booleanisField()Returns whether this declaration is a field.default booleanisMethod()Returns whether this declaration is a method.default booleanisPackage()Returns whether this declaration is a package.default booleanisParameter()Returns whether this declaration is a method parameter.default booleanisRecordComponent()Returns whether this declaration is a record component.default booleanisType()Returns whether this annotation target is a type.DeclarationInfo.Kindkind()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:AnnotationTargetReturns whether this annotation target is a declaration.- Specified by:
 isDeclarationin interfaceAnnotationTarget- Returns:
 trueif this is a declaration,falseotherwise
 
- 
isType
default boolean isType()
Description copied from interface:AnnotationTargetReturns whether this annotation target is a type.- Specified by:
 isTypein interfaceAnnotationTarget- Returns:
 trueif this is a type,falseotherwise
 
- 
asDeclaration
default DeclarationInfo asDeclaration()
Description copied from interface:AnnotationTargetReturns this annotation target as a declaration.- Specified by:
 asDeclarationin interfaceAnnotationTarget- Returns:
 - this declaration, never 
null 
 
- 
asType
default Type asType()
Description copied from interface:AnnotationTargetReturns this annotation target as a type.- Specified by:
 asTypein 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:
 trueif this is a package,falseotherwise
 
- 
isClass
default boolean isClass()
Returns whether this declaration is a class.- Returns:
 trueif this is a class,falseotherwise
 
- 
isMethod
default boolean isMethod()
Returns whether this declaration is a method.- Returns:
 trueif this is a method,falseotherwise
 
- 
isParameter
default boolean isParameter()
Returns whether this declaration is a method parameter.- Returns:
 trueif this is a parameter,falseotherwise
 
- 
isField
default boolean isField()
Returns whether this declaration is a field.- Returns:
 trueif this is a field,falseotherwise
 
- 
isRecordComponent
default boolean isRecordComponent()
Returns whether this declaration is a record component.- Returns:
 trueif this is a record component,falseotherwise
 
- 
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
 
 - 
 
 -