Package spoon.reflect.declaration
Interface CtAnonymousExecutable
- All Superinterfaces:
Cloneable
,CtBodyHolder
,CtElement
,CtExecutable<Void>
,CtModifiable
,CtNamedElement
,CtQueryable
,CtTypedElement<Void>
,CtTypeMember
,CtVisitable
,FactoryAccessor
,Serializable
,SourcePositionHolder
- All Known Implementing Classes:
CtAnonymousExecutableImpl
This element defines an anonymous executable block declaration in a class.
- See Also:
CtClass
-
Field Summary
Fields inherited from interface spoon.reflect.declaration.CtExecutable
EXECUTABLE_SEPARATOR
-
Method Summary
Modifier and TypeMethodDescription<T extends CtExecutable<Void>>
TaddParameter(CtParameter<?> parameter)
Add a parameter for this executable<T extends CtExecutable<Void>>
TaddParameterAt(int position, CtParameter<?> parameter)
Add a parameter at a specific position in the executable.<T extends CtExecutable<Void>>
TaddThrownType(CtTypeReference<? extends Throwable> throwType)
add a thrown type.clone()
Clone the element which calls this method in a new object.<T extends CtExecutable<Void>>
TsetParameters(List<CtParameter<?>> parameters)
Sets the parameters.<C extends CtNamedElement>
CsetSimpleName(String simpleName)
Sets the simple (unqualified) name of this element.<T extends CtExecutable<Void>>
TsetThrownTypes(Set<CtTypeReference<? extends Throwable>> thrownTypes)
Sets the thrown types.<C extends CtTypedElement>
CsetType(CtTypeReference type)
Sets this element's type.Methods inherited from interface spoon.reflect.code.CtBodyHolder
setBody
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, 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.CtExecutable
getBody, getParameters, getReference, getSignature, getThrownTypes, removeParameter, removeThrownType
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
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.declaration.CtTypedElement
getType
Methods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelType
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
clone
CtAnonymousExecutable 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 interfaceCtExecutable<Void>
- Specified by:
clone
in interfaceCtNamedElement
-
setSimpleName
Description copied from interface:CtNamedElement
Sets the simple (unqualified) name of this element.- Specified by:
setSimpleName
in interfaceCtNamedElement
-
setThrownTypes
<T extends CtExecutable<Void>> T setThrownTypes(Set<CtTypeReference<? extends Throwable>> thrownTypes)Description copied from interface:CtExecutable
Sets the thrown types.- Specified by:
setThrownTypes
in interfaceCtExecutable<Void>
-
setParameters
Description copied from interface:CtExecutable
Sets the parameters.- Specified by:
setParameters
in interfaceCtExecutable<Void>
-
setType
Description copied from interface:CtTypedElement
Sets this element's type.- Specified by:
setType
in interfaceCtTypedElement<Void>
-
addParameter
Description copied from interface:CtExecutable
Add a parameter for this executable- Specified by:
addParameter
in interfaceCtExecutable<Void>
- Returns:
- true if this element changed as a result of the call
-
addParameterAt
Description copied from interface:CtExecutable
Add a parameter at a specific position in the executable.- Specified by:
addParameterAt
in interfaceCtExecutable<Void>
- Parameters:
position
- index where the `parameter` needs to be insertedparameter
- parameter to be inserted- Returns:
- an object or sub-type of
CtExecutable
-
addThrownType
Description copied from interface:CtExecutable
add a thrown type.- Specified by:
addThrownType
in interfaceCtExecutable<Void>
- Returns:
- true if this element changed as a result of the call
-