Class RecordComponentInfo
- All Implemented Interfaces:
AnnotationTarget
,Declaration
,Descriptor
,GenericSignature
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
FieldsFields inherited from interface org.jboss.jandex.Descriptor
NO_SUBSTITUTION
Fields inherited from interface org.jboss.jandex.GenericSignature
NO_SUBSTITUTION
-
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) 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 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
final RecordComponentInfo
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 AnnotationInstance
declaredAnnotation
(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 ClassInfo
Returns the (record) class declaring this record component.descriptor
(Function<String, Type> typeVariableSubstitution) Returns a bytecode descriptor of this record component.boolean
final FieldInfo
field()
Returns the component field corresponding to this record component.genericSignature
(Function<String, Type> typeVariableSubstitution) Returns a generic signature of this record component, possibly without any generic-related information.final boolean
hasAnnotation
(DotName name) Returns whether an annotation instance with given name is declared on this record component or any type within its signature.final boolean
hasDeclaredAnnotation
(DotName name) Returns whether an annotation instance with given name is declared on this record component.int
hashCode()
kind()
Returns the kind of object this target represents.final String
name()
Returns the name of this record component.(package private) RecordComponentInternal
boolean
Returns whether this record component must have a generic signature.(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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.jandex.AnnotationTarget
annotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation
Methods inherited from interface org.jboss.jandex.Declaration
asDeclaration, isDeclaration
Methods inherited from interface org.jboss.jandex.Descriptor
descriptor
Methods inherited from interface org.jboss.jandex.GenericSignature
genericSignature, genericSignatureIfRequired, genericSignatureIfRequired
-
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
-
hasAnnotation
Returns whether an annotation instance with given name is declared on this record component or any type within its signature.- Specified by:
hasAnnotation
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type to look for, must not benull
- Returns:
true
if the annotation is present,false
otherwise- 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:
annotation
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type to look for, must not benull
- Returns:
- the annotation instance, or
null
if 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:
annotations
in 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:
annotationsWithRepeatable
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type, must not benull
index
- 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 ifname
does 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:
annotations
in 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:
hasDeclaredAnnotation
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type to look for, must not benull
- Returns:
true
if the annotation is present,false
otherwise- 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:
declaredAnnotation
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type to look for, must not benull
- Returns:
- the annotation instance, or
null
if 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:
declaredAnnotationsWithRepeatable
in interfaceAnnotationTarget
- Parameters:
name
- name of the annotation type, must not benull
index
- 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 ifname
does 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:
declaredAnnotations
in interfaceAnnotationTarget
- Returns:
- immutable list of annotation instances, never
null
- Since:
- 3.0
- See Also:
-
requiresGenericSignature
public boolean requiresGenericSignature()Returns whether this record component must have a generic signature. That is, whether the Java compiler when compiling this record component had to emit theSignature
bytecode attribute.- Specified by:
requiresGenericSignature
in interfaceGenericSignature
- Returns:
- whether this record component must have a generic signature
-
genericSignature
Returns a generic signature of this record component, possibly without any generic-related information. That is, produces a correct generic signature even if this record component does not use any type variables.Signatures of type variables are substituted for signatures of types provided by the substitution function
typeVariableSubstitution
. If the substitution function returnsnull
for some type variable identifier, no substitution happens and the type variable signature is used unmodified.Note that the return value does not come directly from bytecode. Jandex does not store the signature strings. Instead, the return value is reconstructed from the Jandex object model.
- Specified by:
genericSignature
in interfaceGenericSignature
- Parameters:
typeVariableSubstitution
- a substitution function from type variable identifiers to types- Returns:
- a generic signature of this record component with type variables substituted, never
null
-
descriptor
Returns a bytecode descriptor of this record component.Descriptors of type variables are substituted for descriptors of types provided by the substitution function
typeVariableSubstitution
. If the substitution function returnsnull
for some type variable identifier, or if it returns the type variable itself, no substitution happens and the type variable descriptor is used unmodified.Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.
- Specified by:
descriptor
in interfaceDescriptor
- Parameters:
typeVariableSubstitution
- a substitution function from type variable identifiers to types- Returns:
- the bytecode descriptor of this record component
-
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: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
-