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
setBodyMethods 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, updateAllParentsBelowMethods inherited from interface spoon.reflect.declaration.CtExecutable
getBody, getParameters, getReference, getSignature, getThrownTypes, removeParameter, removeThrownTypeMethods 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
getSimpleNameMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtTypedElement
getTypeMethods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelTypeMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
clone
CtAnonymousExecutable 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 interfaceCtExecutable<Void>- Specified by:
clonein interfaceCtNamedElement
-
setSimpleName
Description copied from interface:CtNamedElementSets the simple (unqualified) name of this element.- Specified by:
setSimpleNamein interfaceCtNamedElement
-
setThrownTypes
<T extends CtExecutable<Void>> T setThrownTypes(Set<CtTypeReference<? extends Throwable>> thrownTypes)Description copied from interface:CtExecutableSets the thrown types.- Specified by:
setThrownTypesin interfaceCtExecutable<Void>
-
setParameters
Description copied from interface:CtExecutableSets the parameters.- Specified by:
setParametersin interfaceCtExecutable<Void>
-
setType
Description copied from interface:CtTypedElementSets this element's type.- Specified by:
setTypein interfaceCtTypedElement<Void>
-
addParameter
Description copied from interface:CtExecutableAdd a parameter for this executable- Specified by:
addParameterin interfaceCtExecutable<Void>- Returns:
- true if this element changed as a result of the call
-
addParameterAt
Description copied from interface:CtExecutableAdd a parameter at a specific position in the executable.- Specified by:
addParameterAtin 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:CtExecutableadd a thrown type.- Specified by:
addThrownTypein interfaceCtExecutable<Void>- Returns:
- true if this element changed as a result of the call
-