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 typeboolean
Returns true if this parameter is a lambda parameter with type defined using the `var` keyword (since Java 11).boolean
Returns 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, updateAllParentsBelow
Methods 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, setVisibility
Methods inherited from interface spoon.reflect.declaration.CtNamedElement
getSimpleName, setSimpleName
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadow
Methods inherited from interface spoon.reflect.declaration.CtTypedElement
getType, setType
Methods inherited from interface spoon.reflect.declaration.CtVariable
getDefaultExpression, isPartOfJointDeclaration
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods 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:
getReference
in interfaceCtNamedElement
- Specified by:
getReference
in interfaceCtVariable<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 methodsRefactoring.copyType(CtType)
andRefactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.- Specified by:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtNamedElement
-
setDefaultExpression
Description copied from interface:CtVariable
Sets the initialization expression assigned to the variable, when declared.- Specified by:
setDefaultExpression
in 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.
-