Interface CtRecordComponent

All Superinterfaces:
Cloneable, CtElement, CtNamedElement, CtQueryable, CtShadowable, CtTypedElement<Object>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Implementing Classes:
CtRecordComponentImpl

public interface CtRecordComponent extends CtTypedElement<Object>, CtNamedElement, CtShadowable
This element represents a record component. Example:
    // x is a record component
    record Point(int x) {
    }
 
  • Method Details

    • toMethod

      CtMethod<?> toMethod()
      Converts the component to an implicit method. The returned method is a view and has no parent. This means that any modification on the returned method will not be reflected on the component. Also this element is not part of the model. A record already has the methods corresponding to its components. Use CtType.getMethods() to get the getter methods of a record.
      Returns:
      the method corresponding to the component (a getter) as a view.
    • toField

      CtField<?> toField()
      Converts the component to an implicit field.The returned field is a view and has no parent. This means that any modification on the returned field will not be reflected on the component. Also this element is not part of the model. A record already has the field corresponding to its components. Use CtType.getFields() to get the fields of a record.
      Returns:
      the field corresponding to the component as a view.
    • clone

      Description copied from interface: CtElement
      Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtNamedElement