Top Description Fields Constructors Methods
org.jboss.jandex

public final Class RecordComponentInfo

extends Object
implements Declaration, Descriptor, GenericSignature
Class Inheritance
All Implemented Interfaces
org.jboss.jandex.GenericSignature, org.jboss.jandex.Descriptor, org.jboss.jandex.Declaration, org.jboss.jandex.AnnotationTarget
Imports
java.util.ArrayList, .Collections, .List, java.util.function.Function

Represents an individual Java record component that was annotated.

Thread-Safety

This class is immutable and can be shared between threads without safe publication.

Field Summary

Modifier and TypeField and Description
private ClassInfo
private RecordComponentInternal

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv
RecordComponentInfo(ClassInfo clazz, byte[] name, Type type)

Method Summary

Modifier and TypeMethod and Description
public final MethodInfo

Returns:

the accessor method
accessor
()

Returns the accessor method corresponding to this record component.

public final AnnotationInstance

Returns:

the annotation instance, or null if not found
annotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.annotation.

Returns the annotation instance with given name declared on this record component or any type within its signature.
public final List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotations
(DotName
name of the annotation type, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances with given name declared on this record component or any type within its signature.
public final List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotations
()

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances declared on this record component or any type within its signature.
public final List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotationsWithRepeatable
(DotName
name of the annotation type, must not be null
name
,
IndexView
index used to obtain the annotation type, must not be null
index
)

Implements org.jboss.jandex.AnnotationTarget.annotationsWithRepeatable.

Returns the annotation instances with given name declared on this record component or any type within its signature.
public final ClassInfo
asClass()

Implements org.jboss.jandex.AnnotationTarget.asClass.

Casts and returns this target as a ClassInfo if it is of kind CLASS
public final FieldInfo
asField()

Implements org.jboss.jandex.AnnotationTarget.asField.

Casts and returns this target as a FieldInfo if it is of kind FIELD
public final MethodInfo
asMethod()

Implements org.jboss.jandex.AnnotationTarget.asMethod.

Casts and returns this target as a MethodInfo if it is of kind METHOD
public final MethodParameterInfo
asMethodParameter()

Implements org.jboss.jandex.AnnotationTarget.asMethodParameter.

Casts and returns this target as a MethodParameterInfo if it is of kind METHOD_PARAMETER
public final RecordComponentInfo
asRecordComponent()

Implements org.jboss.jandex.AnnotationTarget.asRecordComponent.

Casts and returns this target as a RecordComponentInfo if it is of kind RECORD_COMPONENT
public final TypeTarget
asType()

Implements org.jboss.jandex.AnnotationTarget.asType.

Casts and returns this target as a TypeTarget if it is of kind TYPE
public static RecordComponentInfo

Returns:

the new mock record component info
create
(ClassInfo
the (record) class declaring this record component
clazz
,
String
the name of this record component
name
,
Type
the type of this record component
type
)

Constructs a new mock record component info

public final AnnotationInstance

Returns:

the annotation instance, or null if not found
declaredAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotation.

Returns the annotation instance with given name declared on this record component.
public final List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
declaredAnnotations
()

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotations.

Returns the annotation instances declared on this record component.
public final List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
declaredAnnotationsWithRepeatable
(DotName
name of the annotation type, must not be null
name
,
IndexView
index used to obtain the annotation type, must not be null
index
)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotationsWithRepeatable.

Returns the annotation instances with given name declared on this record component.
public final ClassInfo

Returns:

the (record) class declaring this record component
declaringClass
()

Returns the (record) class declaring this record component.

public String

Returns:

the bytecode descriptor of this record component
descriptor
(Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
)

Implements org.jboss.jandex.Descriptor.descriptor.

Returns a bytecode descriptor of this record component.
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final FieldInfo

Returns:

the component field
field
()

Returns the component field corresponding to this record component.

public String

Returns:

a generic signature of this record component with type variables substituted, never null
genericSignature
(Function<String, Type>
a substitution function from type variable identifiers to types
typeVariableSubstitution
)

Implements org.jboss.jandex.GenericSignature.genericSignature.

Returns a generic signature of this record component, possibly without any generic-related information.
public final boolean

Returns:

true if the annotation is present, false otherwise
hasAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.hasAnnotation.

Returns whether an annotation instance with given name is declared on this record component or any type within its signature.
public final boolean

Returns:

true if the annotation is present, false otherwise
hasDeclaredAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.hasDeclaredAnnotation.

Returns whether an annotation instance with given name is declared on this record component.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public AnnotationTarget.Kind
kind()

Implements org.jboss.jandex.AnnotationTarget.kind.

Returns the kind of object this target represents.
public final String

Returns:

the name of this record component
name
()

Returns the name of this record component.

pack-priv RecordComponentInternal
public boolean

Returns:

whether this record component must have a generic signature
requiresGenericSignature
()

Implements org.jboss.jandex.GenericSignature.requiresGenericSignature.

Returns whether this record component must have a generic signature.
pack-priv void
pack-priv void
pack-priv void
pack-priv void
setType(Type type)

public String

Returns:

a string representation of this record component
toString
()

Overrides java.lang.Object.toString.

Returns a string representation describing this record component.
public Type

Returns:

the type of this record component
type
()

Returns the type of this record component.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

clazzback to summary
private ClassInfo clazz
internalback to summary
private RecordComponentInternal internal

Constructor Detail

RecordComponentInfoback to summary
pack-priv RecordComponentInfo()
RecordComponentInfoback to summary
pack-priv RecordComponentInfo(ClassInfo clazz, RecordComponentInternal internal)
RecordComponentInfoback to summary
pack-priv RecordComponentInfo(ClassInfo clazz, byte[] name, Type type)

Method Detail

accessorback to summary
public final MethodInfo accessor()

Returns the accessor method corresponding to this record component.

Returns:MethodInfo

the accessor method

annotationback to summary
public final AnnotationInstance annotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.annotation.

Returns the annotation instance with given name declared on this record component or any type within its signature. The target() 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.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:AnnotationInstance

the annotation instance, or null if not found

See Also
annotations(DotName)
annotationsback to summary
public final List<AnnotationInstance> annotations(DotName name)

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances with given name declared on this record component or any type within its signature. The target() method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.

Parameters
name:DotName

name of the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Since
3.0
See Also
annotationsWithRepeatable(DotName, IndexView), annotations()
annotationsback to summary
public final List<AnnotationInstance> annotations()

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances declared on this record component or any type within its signature. The target() method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

annotationsWithRepeatableback to summary
public final List<AnnotationInstance> annotationsWithRepeatable(DotName name, IndexView index)

Implements org.jboss.jandex.AnnotationTarget.annotationsWithRepeatable.

Returns the annotation instances with given name declared on this record component or any type within its signature. The target() 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.

Parameters
name:DotName

name of the annotation type, must not be null

index:IndexView

index used to obtain the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Exceptions
IllegalArgumentException:
if the index is null, if the index does not contain the annotation type or if name does not identify an annotation type
See Also
annotations(DotName), annotations()
asClassback to summary
public final ClassInfo asClass()

Implements org.jboss.jandex.AnnotationTarget.asClass.

Doc from org.jboss.jandex.AnnotationTarget.asClass.

Casts and returns this target as a ClassInfo if it is of kind CLASS

Returns:ClassInfo

this instance cast to a class

Annotations
@Override
asFieldback to summary
public final FieldInfo asField()

Implements org.jboss.jandex.AnnotationTarget.asField.

Doc from org.jboss.jandex.AnnotationTarget.asField.

Casts and returns this target as a FieldInfo if it is of kind FIELD

Returns:FieldInfo

this instance cast to a field

Annotations
@Override
asMethodback to summary
public final MethodInfo asMethod()

Implements org.jboss.jandex.AnnotationTarget.asMethod.

Doc from org.jboss.jandex.AnnotationTarget.asMethod.

Casts and returns this target as a MethodInfo if it is of kind METHOD

Returns:MethodInfo

this instance cast to a method

Annotations
@Override
asMethodParameterback to summary
public final MethodParameterInfo asMethodParameter()

Implements org.jboss.jandex.AnnotationTarget.asMethodParameter.

Doc from org.jboss.jandex.AnnotationTarget.asMethodParameter.

Casts and returns this target as a MethodParameterInfo if it is of kind METHOD_PARAMETER

Returns:MethodParameterInfo

this instance cast to a method parameter

Annotations
@Override
asRecordComponentback to summary
public final RecordComponentInfo asRecordComponent()

Implements org.jboss.jandex.AnnotationTarget.asRecordComponent.

Doc from org.jboss.jandex.AnnotationTarget.asRecordComponent.

Casts and returns this target as a RecordComponentInfo if it is of kind RECORD_COMPONENT

Returns:RecordComponentInfo

this instance cast to a record component

Annotations
@Override
asTypeback to summary
public final TypeTarget asType()

Implements org.jboss.jandex.AnnotationTarget.asType.

Doc from org.jboss.jandex.AnnotationTarget.asType.

Casts and returns this target as a TypeTarget if it is of kind TYPE

Returns:TypeTarget

this instance cast to a type target

Annotations
@Override
createback to summary
public static RecordComponentInfo create(ClassInfo clazz, String name, Type type)

Constructs a new mock record component info

Parameters
clazz:ClassInfo

the (record) class declaring this record component

name:String

the name of this record component

type:Type

the type of this record component

Returns:RecordComponentInfo

the new mock record component info

declaredAnnotationback to summary
public final AnnotationInstance declaredAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.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.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:AnnotationInstance

the annotation instance, or null if not found

Annotations
@Override
Since
3.0
See Also
annotation(DotName)
declaredAnnotationsback to summary
public final List<AnnotationInstance> declaredAnnotations()

Implements org.jboss.jandex.AnnotationTarget.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.

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Since
3.0
See Also
annotations()
declaredAnnotationsWithRepeatableback to summary
public final List<AnnotationInstance> declaredAnnotationsWithRepeatable(DotName name, IndexView index)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotationsWithRepeatable.

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.

Parameters
name:DotName

name of the annotation type, must not be null

index:IndexView

index used to obtain the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Exceptions
IllegalArgumentException:
if the index is null, if the index does not contain the annotation type or if name does not identify an annotation type
Since
3.0
See Also
annotationsWithRepeatable(DotName, IndexView)
declaringClassback to summary
public final ClassInfo declaringClass()

Returns the (record) class declaring this record component.

Returns:ClassInfo

the (record) class declaring this record component

descriptorback to summary
public String descriptor(Function<String, Type> typeVariableSubstitution)

Implements org.jboss.jandex.Descriptor.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 returns null 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.

Parameters
typeVariableSubstitution:Function<String, Type>

Doc from org.jboss.jandex.Descriptor.descriptor.

a substitution function from type variable identifiers to types

Returns:String

the bytecode descriptor of this record component

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fieldback to summary
public final FieldInfo field()

Returns the component field corresponding to this record component.

Returns:FieldInfo

the component field

genericSignatureback to summary
public String genericSignature(Function<String, Type> typeVariableSubstitution)

Implements org.jboss.jandex.GenericSignature.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 returns null 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.

Parameters
typeVariableSubstitution:Function<String, Type>

a substitution function from type variable identifiers to types

Returns:String

a generic signature of this record component with type variables substituted, never null

Annotations
@Override
hasAnnotationback to summary
public final boolean hasAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.hasAnnotation.

Returns whether an annotation instance with given name is declared on this record component or any type within its signature.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:boolean

true if the annotation is present, false otherwise

See Also
annotation(DotName)
hasDeclaredAnnotationback to summary
public final boolean hasDeclaredAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.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.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:boolean

true if the annotation is present, false otherwise

Annotations
@Override
Since
3.0
See Also
hasAnnotation(DotName)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
kindback to summary
public AnnotationTarget.Kind kind()

Implements org.jboss.jandex.AnnotationTarget.kind.

Doc from org.jboss.jandex.AnnotationTarget.kind.

Returns the kind of object this target represents.

Returns:AnnotationTarget.Kind

the target kind.

Annotations
@Override
nameback to summary
public final String name()

Returns the name of this record component.

Returns:String

the name of this record component

recordComponentInternalback to summary
pack-priv RecordComponentInternal recordComponentInternal()
requiresGenericSignatureback to summary
public boolean requiresGenericSignature()

Implements org.jboss.jandex.GenericSignature.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 the Signature bytecode attribute.

Returns:boolean

whether this record component must have a generic signature

Annotations
@Override
setAnnotationsback to summary
pack-priv void setAnnotations(List<AnnotationInstance> annotations)
setClassInfoback to summary
pack-priv void setClassInfo(ClassInfo clazz)
setRecordComponentInternalback to summary
pack-priv void setRecordComponentInternal(RecordComponentInternal internal)
setTypeback to summary
pack-priv void setType(Type type)
toStringback to summary
public String toString()

Overrides java.lang.Object.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.

Returns:String

a string representation of this record component

typeback to summary
public Type type()

Returns the type of this record component.

Returns:Type

the type of this record component