Interface CtConstructor<T>

All Superinterfaces:
Cloneable, CtBodyHolder, CtElement, CtExecutable<T>, CtFormalTypeDeclarer, CtModifiable, CtNamedElement, CtQueryable, CtShadowable, CtTypedElement<T>, CtTypeMember, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Implementing Classes:
CtConstructorImpl, InvisibleArrayConstructorImpl

public interface CtConstructor<T> extends CtExecutable<T>, CtFormalTypeDeclarer, CtShadowable
This element defines a constructor declaration.
  • Method Details

    • getSimpleName

      String getSimpleName()
      Always returns "<init>".
      Specified by:
      getSimpleName in interface CtNamedElement
    • clone

      CtConstructor<T> 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 CtExecutable<T>
      Specified by:
      clone in interface CtNamedElement
    • setType

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

      <C extends CtNamedElement> C setSimpleName(String simpleName)
      Description copied from interface: CtNamedElement
      Sets the simple (unqualified) name of this element.
      Specified by:
      setSimpleName in interface CtNamedElement
    • isCompactConstructor

      boolean isCompactConstructor()
      Checks if the constructor is a compact constructor. Only records have compact constructors.
      Returns:
      true if the constructor is a compact constructor.
    • setCompactConstructor

      void setCompactConstructor(boolean compactConstructor)
      Marks the constructor as a compact constructor. Only records have compact constructors.
      Parameters:
      compactConstructor - true if the constructor is a compact constructor, false otherwise