AnnotatedElementpublic final class RecordComponent extends Object implements AnnotatedElement
RecordComponent provides information about, and dynamic access to, a component of a record class.| Modifier and Type | Method | Description | 
|---|---|---|
| Method | getAccessor() | Returns a  Methodthat represents the accessor for this record component. | 
| AnnotatedType | getAnnotatedType() | Returns an  AnnotatedTypeobject that represents the use of a type to specify the declared type of this record component. | 
| <T extends Annotation> | getAnnotation | Returns this element's annotation for the specified type if such an annotation is present, else null. | 
| Annotation[] | getAnnotations() | Returns annotations that are present on this element. | 
| Annotation[] | getDeclaredAnnotations() | Returns annotations that are directly present on this element. | 
| Class | getDeclaringRecord() | Returns the record class which declares this record component. | 
| String | getGenericSignature() | Returns a  Stringthat describes the generic type signature for this record component. | 
| Type | getGenericType() | Returns a  Typeobject that represents the declared type for this record component. | 
| String | getName() | Returns the name of this record component. | 
| Class | getType() | Returns a  Classthat identifies the declared type for this record component. | 
| String | toString() | Returns a string describing this record component. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType, isAnnotationPresent
public String getName()
public Class<?> getType()
Class that identifies the declared type for this record component.Class identifying the declared type of the component represented by this record componentpublic String getGenericSignature()
String that describes the generic type signature for this record component.String that describes the generic type signature for this record componentpublic Type getGenericType()
Type object that represents the declared type for this record component. If the declared type of the record component is a parameterized type, the Type object returned reflects the actual type arguments used in the source code. 
If the type of the underlying record component is a type variable or a parameterized type, it is created. Otherwise, it is resolved.
Type object that represents the declared type for this record componentGenericSignatureFormatError - if the generic record component signature does not conform to the format specified in The Java Virtual Machine Specification
TypeNotPresentException - if the generic type signature of the underlying record component refers to a non-existent type declarationMalformedParameterizedTypeException - if the generic signature of the underlying record component refers to a parameterized type that cannot be instantiated for any reasonpublic AnnotatedType getAnnotatedType()
AnnotatedType object that represents the use of a type to specify the declared type of this record component.public Method getAccessor()
Method that represents the accessor for this record component.Method that represents the accessor for this record componentpublic <T extends Annotation> T getAnnotation(Class<T> annotationClass)
Note that any annotation returned by this method is a declaration annotation.
getAnnotation in interface AnnotatedElement
T - the type of the annotation to query for and return if presentannotationClass - the Class object corresponding to the annotation typeNullPointerException - if the given annotation class is nullpublic Annotation[] getAnnotations()
Note that any annotations returned by this method are declaration annotations.
getAnnotations in interface AnnotatedElement
public Annotation[] getDeclaredAnnotations()
Note that any annotations returned by this method are declaration annotations.
getDeclaredAnnotations in interface AnnotatedElement
public String toString()
    java.lang.String name
    int age
 
public Class<?> getDeclaringRecord()
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/reflect/RecordComponent.html