Class CtRecordComponentImpl

All Implemented Interfaces:
Serializable, Cloneable, FactoryAccessor, SourcePositionHolder, CtElement, CtNamedElement, CtRecordComponent, CtShadowable, CtTypedElement<Object>, CtQueryable, CtVisitable

public class CtRecordComponentImpl extends CtNamedElementImpl implements CtRecordComponent
See Also:
Serialized Form
  • Constructor Details

    • CtRecordComponentImpl

      public CtRecordComponentImpl()
  • Method Details

    • toMethod

      public CtMethod<?> toMethod()
      Description copied from interface: CtRecordComponent
      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.
      Specified by:
      toMethod in interface CtRecordComponent
      Returns:
      the method corresponding to the component (a getter) as a view.
    • toField

      public CtField<?> toField()
      Description copied from interface: CtRecordComponent
      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.
      Specified by:
      toField in interface CtRecordComponent
      Returns:
      the field corresponding to the component as a view.
    • isImplicit

      public boolean isImplicit()
      Description copied from interface: CtElement
      Returns true if this element is not present in the code (automatically added by the Java compiler or inferred when the model is built). Consequently, implicit elements are not pretty-printed and have no position.
      Specified by:
      isImplicit in interface CtElement
      Overrides:
      isImplicit in class CtElementImpl
    • getType

      public CtTypeReference<Object> getType()
      Description copied from interface: CtTypedElement
      Gets this element's type.
      Specified by:
      getType in interface CtTypedElement<Object>
    • setType

      public <C extends CtTypedElement> C setType(CtTypeReference type)
      Description copied from interface: CtTypedElement
      Sets this element's type.
      Specified by:
      setType in interface CtTypedElement<Object>
    • accept

      public void accept(CtVisitor visitor)
      Description copied from interface: CtVisitable
      Accepts a visitor
      Specified by:
      accept in interface CtVisitable
    • setSimpleName

      public <T extends CtNamedElement> T setSimpleName(String simpleName)
      Description copied from interface: CtNamedElement
      Sets the simple (unqualified) name of this element.
      Specified by:
      setSimpleName in interface CtNamedElement
      Overrides:
      setSimpleName in class CtNamedElementImpl
    • clone

      public CtRecordComponent 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
      Specified by:
      clone in interface CtRecordComponent
      Overrides:
      clone in class CtNamedElementImpl
    • isShadow

      public boolean isShadow()
      Description copied from interface: CtShadowable
      When an element isn't present in the factory (created in another factory), this element is considered as "shadow". e.g., a shadow element can be a CtType of java.lang.Class built when we call CtTypeReference.getTypeDeclaration() on a reference of java.lang.Class.
      Specified by:
      isShadow in interface CtShadowable
      Returns:
      true if the element is a shadow element, otherwise false.
    • setShadow

      public <E extends CtShadowable> E setShadow(boolean isShadow)
      Description copied from interface: CtShadowable
      Marks an element as shadow. To know what is a shadow element, see the javadoc of CtShadowable.isShadow().
      Specified by:
      setShadow in interface CtShadowable