Class RecComponent


  • public final class RecComponent
    extends java.lang.Object
    A record component, which has a name, a type and an index.

    (If running on Java 14+, this should be a record class ;) )

    The latter is the index of the record components in the class file's record attribute, required to invoke the record's canonical constructor.

    • Constructor Summary

      Constructors 
      Constructor Description
      RecComponent​(java.lang.String name, java.lang.reflect.Type type, java.lang.Class<?> klass, java.lang.annotation.Annotation[] annotations, java.lang.reflect.Method accessor, int index)
      Create a Record component.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.reflect.Method getAccessor()
      Returns a Method that represents the accessor for this record component.
      java.lang.annotation.Annotation[] getDeclaredAnnotations()
      Returns annotations that are directly present on this element.
      int index()
      get the index of the Record component.
      java.lang.String name()
      get the name of the Record component.
      java.lang.Class<?> type()
      get the class of the Record component.
      java.lang.reflect.Type typeGeneric()
      get the type of the Record component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecComponent

        public RecComponent​(java.lang.String name,
                            java.lang.reflect.Type type,
                            java.lang.Class<?> klass,
                            java.lang.annotation.Annotation[] annotations,
                            java.lang.reflect.Method accessor,
                            int index)
        Create a Record component.
        Parameters:
        name - name of the Record component
        type - type of Record component
        klass - class of the Record component
        annotations - Annotations on the component
        accessor - Accessor for this record component.
        index - index of the Record component
    • Method Detail

      • name

        public java.lang.String name()
        get the name of the Record component.
        Returns:
        name of the Record component
      • typeGeneric

        public java.lang.reflect.Type typeGeneric()
        get the type of the Record component.
        Returns:
        type of the Record component
      • index

        public int index()
        get the index of the Record component.
        Returns:
        index of the Record component
      • type

        public java.lang.Class<?> type()
        get the class of the Record component.
        Returns:
        class of the Record component
      • getDeclaredAnnotations

        public java.lang.annotation.Annotation[] getDeclaredAnnotations()
        Returns annotations that are directly present on this element.
        Returns:
        Returns annotations that are directly present on this element.
      • getAccessor

        public java.lang.reflect.Method getAccessor()
        Returns a Method that represents the accessor for this record component.
        Returns:
        Returns a Method that represents the accessor for this record component.