Package spoon.reflect.declaration
Interface CtParameter<T>
- All Superinterfaces:
Cloneable,CtElement,CtModifiable,CtNamedElement,CtQueryable,CtShadowable,CtTypedElement<T>,CtVariable<T>,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Implementing Classes:
CtParameterImpl
This element defines an executable parameter declaration.
- See Also:
CtExecutable
-
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the element which calls this method in a new object.CtExecutable<?>Gets the executable that is the parent declaration of this parameter declaration.overriding the return typebooleanReturns true if this parameter is a lambda parameter with type defined using the `var` keyword (since Java 11).booleanReturns true if this parameter accepts a variable number of arguments (must be the last parameter ofCtExecutable.getParameters()).<C extends CtVariable<T>>
CsetDefaultExpression(CtExpression<T> assignedExpression)Sets the initialization expression assigned to the variable, when declared.<U extends CtParameter<T>>
UsetInferred(boolean inferred)Set to true if this parameter is a lambda parameter with type defined using the `var` keyword.<C extends CtParameter<T>>
CsetVarArgs(boolean varArgs)Sets this parameter to have varargs.Methods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelowMethods inherited from interface spoon.reflect.declaration.CtModifiable
addModifier, getExtendedModifiers, getModifiers, getVisibility, hasModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, removeModifier, setExtendedModifiers, setModifiers, setVisibilityMethods inherited from interface spoon.reflect.declaration.CtNamedElement
getSimpleName, setSimpleNameMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadowMethods inherited from interface spoon.reflect.declaration.CtTypedElement
getType, setTypeMethods inherited from interface spoon.reflect.declaration.CtVariable
getDefaultExpression, isPartOfJointDeclarationMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getParent
CtExecutable<?> getParent()Gets the executable that is the parent declaration of this parameter declaration. (Overriding the return type) -
isVarArgs
boolean isVarArgs()Returns true if this parameter accepts a variable number of arguments (must be the last parameter ofCtExecutable.getParameters()). -
setVarArgs
Sets this parameter to have varargs. -
getReference
CtParameterReference<T> getReference()overriding the return type- Specified by:
getReferencein interfaceCtNamedElement- Specified by:
getReferencein interfaceCtVariable<T>
-
clone
CtParameter<T> clone()Description copied from interface:CtElementClone 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 methodsRefactoring.copyType(CtType)andRefactoring.copyMethod(CtMethod)instead which does additional work beyond cloning.- Specified by:
clonein interfaceCtElement- Specified by:
clonein interfaceCtNamedElement
-
setDefaultExpression
Description copied from interface:CtVariableSets the initialization expression assigned to the variable, when declared.- Specified by:
setDefaultExpressionin interfaceCtVariable<T>
-
isInferred
boolean isInferred()Returns true if this parameter is a lambda parameter with type defined using the `var` keyword (since Java 11). -
setInferred
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.
-