Package spoon.reflect.code
Interface CtCatchVariable<T>
- Type Parameters:
T- type of the variable
- All Superinterfaces:
Cloneable,CtCodeElement,CtElement,CtModifiable,CtMultiTypedElement,CtNamedElement,CtQueryable,CtTypedElement<T>,CtVariable<T>,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Implementing Classes:
CtCatchVariableImpl
This code element defines an exception variable in a catch.
-
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the element which calls this method in a new object.Returns the corresponding reference.getType()Returns type reference of the exception variable in a catch.<C extends CtVariable<T>>
CsetDefaultExpression(CtExpression<T> assignedExpression)Sets the initialization expression assigned to the variable, when declared.<C extends CtTypedElement>
CsetType(CtTypeReference type)Sets this element's type.Methods inherited from interface spoon.reflect.code.CtCodeElement
partiallyEvaluateMethods 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.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.CtMultiTypedElement
addMultiType, getMultiTypes, removeMultiType, setMultiTypesMethods 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.CtVariable
getDefaultExpression, isPartOfJointDeclarationMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getReference
CtCatchVariableReference<T> getReference()Description copied from interface:CtNamedElementReturns the corresponding reference.- Specified by:
getReferencein interfaceCtNamedElement- Specified by:
getReferencein interfaceCtVariable<T>
-
clone
CtCatchVariable<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 interfaceCtCodeElement- 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>
-
getType
CtTypeReference<T> getType()Returns type reference of the exception variable in a catch. If type is unknown, or any of the types in a multi-catch is unknown, returns null.- Specified by:
getTypein interfaceCtTypedElement<T>
-
setType
Description copied from interface:CtTypedElementSets this element's type.- Specified by:
setTypein interfaceCtTypedElement<T>
-