public final class RecordComponentInfo extends Object implements AnnotationTarget
Thread-Safety
This class is immutable and can be shared between threads without safe publication.AnnotationTarget.Kind| Modifier and Type | Method and Description |
|---|---|
MethodInfo |
accessor()
Returns the accessor method corresponding to this record component.
|
AnnotationInstance |
annotation(DotName name)
Returns the annotation instance with given name declared on this record component or any type within its signature.
|
List<AnnotationInstance> |
annotations()
Returns the annotation instances declared on this record component or any type within its signature.
|
List<AnnotationInstance> |
annotations(DotName name)
Returns the annotation instances with given name declared on this record component or any type within its signature.
|
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.
|
ClassInfo |
asClass()
Casts and returns this target as a
ClassInfo if it is of kind CLASS |
FieldInfo |
asField()
Casts and returns this target as a
FieldInfo if it is of kind FIELD |
MethodInfo |
asMethod()
Casts and returns this target as a
MethodInfo if it is of kind METHOD |
MethodParameterInfo |
asMethodParameter()
Casts and returns this target as a
MethodParameterInfo if it is of kind METHOD_PARAMETER |
RecordComponentInfo |
asRecordComponent()
Casts and returns this target as a
RecordComponentInfo if it is of kind RECORD_COMPONENT |
TypeTarget |
asType()
Casts and returns this target as a
TypeTarget if it is of kind TYPE |
static RecordComponentInfo |
create(ClassInfo clazz,
String name,
Type type)
Constructs a new mock record component info
|
AnnotationInstance |
declaredAnnotation(DotName name)
Returns the annotation instance with given name declared on this record component.
|
List<AnnotationInstance> |
declaredAnnotations()
Returns the annotation instances declared on this record component.
|
List<AnnotationInstance> |
declaredAnnotationsWithRepeatable(DotName name,
IndexView index)
Returns the annotation instances with given name declared on this record component.
|
ClassInfo |
declaringClass()
Returns the (record) class declaring this record component.
|
boolean |
equals(Object o) |
FieldInfo |
field()
Returns the component field corresponding to this record component.
|
boolean |
hasAnnotation(DotName name)
Returns whether an annotation instance with given name is declared on this record component or any type
within its signature.
|
boolean |
hasDeclaredAnnotation(DotName name)
Returns whether an annotation instance with given name is declared on this record component.
|
int |
hashCode() |
AnnotationTarget.Kind |
kind()
Returns the kind of object this target represents.
|
String |
name()
Returns the name of this record component.
|
String |
toString()
Returns a string representation describing this record component.
|
Type |
type()
Returns the type of this record component.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitannotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotationpublic static RecordComponentInfo create(ClassInfo clazz, String name, Type type)
clazz - the (record) class declaring this record componentname - the name of this record componenttype - the type of this record componentpublic final ClassInfo declaringClass()
public final FieldInfo field()
public final MethodInfo accessor()
public final String name()
public Type type()
public final boolean hasAnnotation(DotName name)
hasAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nulltrue if the annotation is present, false otherwiseannotation(DotName)public final AnnotationInstance annotation(DotName name)
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.
annotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nullnull if not foundannotations(DotName)public final List<AnnotationInstance> annotations(DotName name)
target() method of the returned annotation instances may be used to determine the exact location
of the respective annotation instance.annotations in interface AnnotationTargetname - name of the annotation type, must not be nullnullannotationsWithRepeatable(DotName, IndexView),
annotations()public final List<AnnotationInstance> annotationsWithRepeatable(DotName name, IndexView index)
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.
annotationsWithRepeatable in interface AnnotationTargetname - name of the annotation type, must not be nullindex - index used to obtain the annotation type, must not be nullnullIllegalArgumentException - if the index is null, if the index does not contain the annotation type
or if name does not identify an annotation typeannotations(DotName),
annotations()public final List<AnnotationInstance> annotations()
target() method of the returned annotation instances may be used to determine the exact location
of the respective annotation instance.annotations in interface AnnotationTargetnullpublic final boolean hasDeclaredAnnotation(DotName name)
Unlike hasAnnotation(DotName), this method ignores annotations declared on
types within the record component signature.
hasDeclaredAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nulltrue if the annotation is present, false otherwisehasAnnotation(DotName)public final AnnotationInstance declaredAnnotation(DotName name)
Unlike annotation(DotName), this method doesn't return annotations declared on types
within the record component signature.
declaredAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nullnull if not foundannotation(DotName)public final List<AnnotationInstance> declaredAnnotationsWithRepeatable(DotName name, IndexView index)
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.
declaredAnnotationsWithRepeatable in interface AnnotationTargetname - name of the annotation type, must not be nullindex - index used to obtain the annotation type, must not be nullnullIllegalArgumentException - if the index is null, if the index does not contain the annotation type
or if name does not identify an annotation typeannotationsWithRepeatable(DotName, IndexView)public final List<AnnotationInstance> declaredAnnotations()
Unlike annotations(), this method doesn't return annotations declared on types
within the record component signature.
declaredAnnotations in interface AnnotationTargetnullannotations()public String toString()
public final ClassInfo asClass()
AnnotationTargetClassInfo if it is of kind CLASSasClass in interface AnnotationTargetpublic final FieldInfo asField()
AnnotationTargetFieldInfo if it is of kind FIELDasField in interface AnnotationTargetpublic final MethodInfo asMethod()
AnnotationTargetMethodInfo if it is of kind METHODasMethod in interface AnnotationTargetpublic final MethodParameterInfo asMethodParameter()
AnnotationTargetMethodParameterInfo if it is of kind METHOD_PARAMETERasMethodParameter in interface AnnotationTargetpublic final TypeTarget asType()
AnnotationTargetTypeTarget if it is of kind TYPEasType in interface AnnotationTargetpublic final RecordComponentInfo asRecordComponent()
AnnotationTargetRecordComponentInfo if it is of kind RECORD_COMPONENTasRecordComponent in interface AnnotationTargetpublic AnnotationTarget.Kind kind()
AnnotationTargetkind in interface AnnotationTargetCopyright © 2018–2022. All rights reserved.