Interface CtParameter<T>

All Superinterfaces:
Cloneable, CtElement, CtModifiable, CtNamedElement, CtQueryable, CtShadowable, CtTypedElement<T>, CtVariable<T>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Implementing Classes:
CtParameterImpl

public interface CtParameter<T> extends CtVariable<T>, CtShadowable
This element defines an executable parameter declaration.
See Also:
CtExecutable
  • Method Details

    • getParent

      CtExecutable<?> getParent()
      Gets the executable that is the parent declaration of this parameter declaration. (Overriding the return type)
      Specified by:
      getParent in interface CtElement
    • isVarArgs

      boolean isVarArgs()
      Returns true if this parameter accepts a variable number of arguments (must be the last parameter of CtExecutable.getParameters()).
    • setVarArgs

      <C extends CtParameter<T>> C setVarArgs(boolean varArgs)
      Sets this parameter to have varargs.
    • getReference

      CtParameterReference<T> getReference()
      overriding the return type
      Specified by:
      getReference in interface CtNamedElement
      Specified by:
      getReference in interface CtVariable<T>
    • clone

      CtParameter<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 CtNamedElement
    • setDefaultExpression

      <C extends CtVariable<T>> C setDefaultExpression(CtExpression<T> assignedExpression)
      Description copied from interface: CtVariable
      Sets the initialization expression assigned to the variable, when declared.
      Specified by:
      setDefaultExpression in interface CtVariable<T>
    • isInferred

      boolean isInferred()
      Returns true if this parameter is a lambda parameter with type defined using the `var` keyword (since Java 11).
    • setInferred

      <U extends CtParameter<T>> U setInferred(boolean inferred)
      Set to true if this parameter is a lambda parameter with type defined using the `var` keyword. Warning: this method should only be used if compliance level is set to 11 or more.