Package org.jboss.jandex
Class RecordComponentInfo
java.lang.Object
org.jboss.jandex.RecordComponentInfo
- All Implemented Interfaces:
AnnotationTarget
Represents an individual Java record component that was annotated.
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRecordComponentInfo
(ClassInfo clazz, byte[] name, Type type) RecordComponentInfo
(ClassInfo clazz, RecordComponentInternal internal) -
Method Summary
Modifier and TypeMethodDescriptionfinal MethodInfo
accessor()
Returns the accessor method corresponding to this record component.final AnnotationInstance
annotation
(DotName name) Retrieves an annotation instance declared on this field.Returns the list of annotation instances declared on this record component.final List
<AnnotationInstance> annotationsWithRepeatable
(DotName name, IndexView index) Retrieves annotation instances declared on this field, by the name of the annotation.final ClassInfo
asClass()
Casts and returns this target as aClassInfo
if it is of kindCLASS
final FieldInfo
asField()
Casts and returns this target as aFieldInfo
if it is of kindFIELD
final MethodInfo
asMethod()
Casts and returns this target as aMethodInfo
if it is of kindMETHOD
final MethodParameterInfo
Casts and returns this target as aMethodParameterInfo
if it is of kindMETHOD_PARAMETER
Casts and returns this target as aRecordComponentInfo
if it is of kindRECORD_COMPONENT
final TypeTarget
asType()
Casts and returns this target as aTypeTarget
if it is of kindTYPE
static RecordComponentInfo
Constructs a new mock record component infofinal ClassInfo
Returns the (record) class declaring this record component.boolean
final FieldInfo
field()
Returns the component field corresponding to this record component.final boolean
hasAnnotation
(DotName name) Returns whether or not the annotation instance with the given name occurs on this fieldint
hashCode()
kind()
Returns the kind of object this target represents.final String
name()
Returns the name of this record component.(package private) RecordComponentInternal
(package private) void
setAnnotations
(List<AnnotationInstance> annotations) (package private) void
setClassInfo
(ClassInfo clazz) (package private) void
(package private) void
toString()
Returns a string representation describing this record component.type()
Returns the type of this record component.
-
Field Details
-
clazz
-
internal
-
-
Constructor Details
-
RecordComponentInfo
RecordComponentInfo() -
RecordComponentInfo
RecordComponentInfo(ClassInfo clazz, RecordComponentInternal internal) -
RecordComponentInfo
-
-
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
-
annotations
Returns the list of annotation instances declared on this record component. It may be empty, but never null.- Returns:
- the list of annotations on this record component
-
annotation
Retrieves an annotation instance declared on this field. If an annotation by that name is not present, null will be returned.- Parameters:
name
- the name of the annotation to locate on this field- Returns:
- the annotation if found, otherwise, null
-
annotationsWithRepeatable
Retrieves annotation instances declared on this field, by the name of the annotation. If the specified annotation is repeatable (JLS 9.6), the result also contains all values from the container annotation instance.- Parameters:
name
- the name of the annotationindex
- the index used to obtain the annotation class- Returns:
- the annotation instances declared on this field, or an empty list if none
- Throws:
IllegalArgumentException
- If the index does not contain the annotation definition or if it does not represent an annotation type
-
hasAnnotation
Returns whether or not the annotation instance with the given name occurs on this field- Parameters:
name
- the name of the annotation to look for- Returns:
- true if the annotation is present, false otherwise
- See Also:
-
toString
Returns a string representation describing this record component. -
asClass
Description copied from interface:AnnotationTarget
Casts and returns this target as aClassInfo
if it is of kindCLASS
- Specified by:
asClass
in interfaceAnnotationTarget
- Returns:
- this instance cast to a class
-
asField
Description copied from interface:AnnotationTarget
Casts and returns this target as aFieldInfo
if it is of kindFIELD
- Specified by:
asField
in interfaceAnnotationTarget
- Returns:
- this instance cast to a field
-
asMethod
Description copied from interface:AnnotationTarget
Casts and returns this target as aMethodInfo
if it is of kindMETHOD
- Specified by:
asMethod
in interfaceAnnotationTarget
- Returns:
- this instance cast to a method
-
asMethodParameter
Description copied from interface:AnnotationTarget
Casts and returns this target as aMethodParameterInfo
if it is of kindMETHOD_PARAMETER
- Specified by:
asMethodParameter
in interfaceAnnotationTarget
- Returns:
- this instance cast to a method parameter
-
asType
Description copied from interface:AnnotationTarget
Casts and returns this target as aTypeTarget
if it is of kindTYPE
- Specified by:
asType
in interfaceAnnotationTarget
- Returns:
- this instance cast to a type target
-
asRecordComponent
Description copied from interface:AnnotationTarget
Casts and returns this target as aRecordComponentInfo
if it is of kindRECORD_COMPONENT
- Specified by:
asRecordComponent
in interfaceAnnotationTarget
- Returns:
- this instance cast to a record component
-
kind
Description copied from interface:AnnotationTarget
Returns the kind of object this target represents.- Specified by:
kind
in interfaceAnnotationTarget
- Returns:
- the target kind.
-
hashCode
public int hashCode() -
equals
-
setType
-
setAnnotations
-
recordComponentInternal
RecordComponentInternal recordComponentInternal() -
setRecordComponentInternal
-
setClassInfo
-