Class RecordComponentInfo
- All Implemented Interfaces:
AnnotationTarget
Thread-Safety
This class is immutable and can be shared between threads without safe publication.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.jandex.AnnotationTarget
AnnotationTarget.Kind -
Method Summary
Modifier and TypeMethodDescriptionfinal MethodInfoaccessor()Returns the accessor method corresponding to this record component.final AnnotationInstanceannotation(DotName name) Returns the annotation instance with given name declared on this record component or any type within its signature.final List<AnnotationInstance>Returns the annotation instances declared on this record component or any type within its signature.final List<AnnotationInstance>annotations(DotName name) Returns the annotation instances with given name declared on this record component or any type within its signature.final List<AnnotationInstance>annotationsWithRepeatable(DotName name, IndexView index) Returns the annotation instances with given name declared on this record component or any type within its signature.final ClassInfoasClass()Casts and returns this target as aClassInfoif it is of kindCLASSfinal FieldInfoasField()Casts and returns this target as aFieldInfoif it is of kindFIELDfinal MethodInfoasMethod()Casts and returns this target as aMethodInfoif it is of kindMETHODfinal MethodParameterInfoCasts and returns this target as aMethodParameterInfoif it is of kindMETHOD_PARAMETERfinal RecordComponentInfoCasts and returns this target as aRecordComponentInfoif it is of kindRECORD_COMPONENTfinal TypeTargetasType()Casts and returns this target as aTypeTargetif it is of kindTYPEstatic RecordComponentInfoConstructs a new mock record component infofinal AnnotationInstancedeclaredAnnotation(DotName name) Returns the annotation instance with given name declared on this record component.final List<AnnotationInstance>Returns the annotation instances declared on this record component.final List<AnnotationInstance>declaredAnnotationsWithRepeatable(DotName name, IndexView index) Returns the annotation instances with given name declared on this record component.final ClassInfoReturns the (record) class declaring this record component.booleanfinal FieldInfofield()Returns the component field corresponding to this record component.final booleanhasAnnotation(DotName name) Returns whether an annotation instance with given name is declared on this record component or any type within its signature.final booleanhasDeclaredAnnotation(DotName name) Returns whether an annotation instance with given name is declared on this record component.inthashCode()kind()Returns the kind of object this target represents.final Stringname()Returns the name of this record component.toString()Returns a string representation describing this record component.type()Returns the type of this record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jboss.jandex.AnnotationTarget
annotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation
-
Method Details
-
create
Constructs a new mock record component info- Parameters:
clazz- the (record) class declaring this record componentname- the name of this record componenttype- the type of this record component- Returns:
- the new mock record component info
-
declaringClass
Returns the (record) class declaring this record component.- Returns:
- the (record) class declaring this record component
-
field
Returns the component field corresponding to this record component.- Returns:
- the component field
-
accessor
Returns the accessor method corresponding to this record component.- Returns:
- the accessor method
-
name
Returns the name of this record component.- Returns:
- the name of this record component
-
type
Returns the type of this record component.- Returns:
- the type of this record component
-
hasAnnotation
Returns whether an annotation instance with given name is declared on this record component or any type within its signature.- Specified by:
hasAnnotationin interfaceAnnotationTarget- Parameters:
name- name of the annotation type to look for, must not benull- Returns:
trueif the annotation is present,falseotherwise- See Also:
-
annotation
Returns the annotation instance with given name declared on this record component or any type within its signature. Thetarget()method of the returned annotation instance may be used to determine the exact location of the annotation instance.In case an annotation with given name occurs more than once, the result of this method is not deterministic. For such situations,
annotations(DotName)is preferable.- Specified by:
annotationin interfaceAnnotationTarget- Parameters:
name- name of the annotation type to look for, must not benull- Returns:
- the annotation instance, or
nullif not found - See Also:
-
annotations
Returns the annotation instances with given name declared on this record component or any type within its signature. Thetarget()method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.- Specified by:
annotationsin interfaceAnnotationTarget- Parameters:
name- name of the annotation type, must not benull- Returns:
- immutable list of annotation instances, never
null - Since:
- 3.0
- See Also:
-
annotationsWithRepeatable
Returns the annotation instances with given name declared on this record component or any type within its signature. Thetarget()method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.If the specified annotation is repeatable, the result also contains all values from the container annotation instance. In this case, the
AnnotationInstance.target()returns the target of the container annotation instance.- Specified by:
annotationsWithRepeatablein interfaceAnnotationTarget- Parameters:
name- name of the annotation type, must not benullindex- index used to obtain the annotation type, must not benull- Returns:
- immutable list of annotation instances, never
null - Throws:
IllegalArgumentException- if the index isnull, if the index does not contain the annotation type or ifnamedoes not identify an annotation type- See Also:
-
annotations
Returns the annotation instances declared on this record component or any type within its signature. Thetarget()method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.- Specified by:
annotationsin interfaceAnnotationTarget- Returns:
- immutable list of annotation instances, never
null
-
hasDeclaredAnnotation
Returns whether an annotation instance with given name is declared on this record component.Unlike
hasAnnotation(DotName), this method ignores annotations declared on types within the record component signature.- Specified by:
hasDeclaredAnnotationin interfaceAnnotationTarget- Parameters:
name- name of the annotation type to look for, must not benull- Returns:
trueif the annotation is present,falseotherwise- Since:
- 3.0
- See Also:
-
declaredAnnotation
Returns the annotation instance with given name declared on this record component.Unlike
annotation(DotName), this method doesn't return annotations declared on types within the record component signature.- Specified by:
declaredAnnotationin interfaceAnnotationTarget- Parameters:
name- name of the annotation type to look for, must not benull- Returns:
- the annotation instance, or
nullif not found - Since:
- 3.0
- See Also:
-
declaredAnnotationsWithRepeatable
public final List<AnnotationInstance> declaredAnnotationsWithRepeatable(DotName name, IndexView index) Returns the annotation instances with given name declared on this record component.If the specified annotation is repeatable, the result also contains all values from the container annotation instance. In this case, the
AnnotationInstance.target()returns the target of the container annotation instance.Unlike
annotationsWithRepeatable(DotName, IndexView), this method doesn't return annotations declared on types within the record component signature.- Specified by:
declaredAnnotationsWithRepeatablein interfaceAnnotationTarget- Parameters:
name- name of the annotation type, must not benullindex- index used to obtain the annotation type, must not benull- Returns:
- immutable list of annotation instances, never
null - Throws:
IllegalArgumentException- if the index isnull, if the index does not contain the annotation type or ifnamedoes not identify an annotation type- Since:
- 3.0
- See Also:
-
declaredAnnotations
Returns the annotation instances declared on this record component.Unlike
annotations(), this method doesn't return annotations declared on types within the record component signature.- Specified by:
declaredAnnotationsin interfaceAnnotationTarget- Returns:
- immutable list of annotation instances, never
null - Since:
- 3.0
- See Also:
-
toString
Returns a string representation describing this record component. It is similar although not necessarily identical to a Java source code declaration of this record component. -
asClass
Description copied from interface:AnnotationTargetCasts and returns this target as aClassInfoif it is of kindCLASS- Specified by:
asClassin interfaceAnnotationTarget- Returns:
- this instance cast to a class
-
asField
Description copied from interface:AnnotationTargetCasts and returns this target as aFieldInfoif it is of kindFIELD- Specified by:
asFieldin interfaceAnnotationTarget- Returns:
- this instance cast to a field
-
asMethod
Description copied from interface:AnnotationTargetCasts and returns this target as aMethodInfoif it is of kindMETHOD- Specified by:
asMethodin interfaceAnnotationTarget- Returns:
- this instance cast to a method
-
asMethodParameter
Description copied from interface:AnnotationTargetCasts and returns this target as aMethodParameterInfoif it is of kindMETHOD_PARAMETER- Specified by:
asMethodParameterin interfaceAnnotationTarget- Returns:
- this instance cast to a method parameter
-
asType
Description copied from interface:AnnotationTargetCasts and returns this target as aTypeTargetif it is of kindTYPE- Specified by:
asTypein interfaceAnnotationTarget- Returns:
- this instance cast to a type target
-
asRecordComponent
Description copied from interface:AnnotationTargetCasts and returns this target as aRecordComponentInfoif it is of kindRECORD_COMPONENT- Specified by:
asRecordComponentin interfaceAnnotationTarget- Returns:
- this instance cast to a record component
-
kind
Description copied from interface:AnnotationTargetReturns the kind of object this target represents.- Specified by:
kindin interfaceAnnotationTarget- Returns:
- the target kind.
-
hashCode
public int hashCode() -
equals
-