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
partiallyEvaluate
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.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.CtMultiTypedElement
addMultiType, getMultiTypes, removeMultiType, setMultiTypes
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.CtVariable
getDefaultExpression, isPartOfJointDeclaration
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getReference
CtCatchVariableReference<T> getReference()Description copied from interface:CtNamedElement
Returns the corresponding reference.- Specified by:
getReference
in interfaceCtNamedElement
- Specified by:
getReference
in interfaceCtVariable<T>
-
clone
CtCatchVariable<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 interfaceCtCodeElement
- 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>
-
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:
getType
in interfaceCtTypedElement<T>
-
setType
Description copied from interface:CtTypedElement
Sets this element's type.- Specified by:
setType
in interfaceCtTypedElement<T>
-