Package spoon.support.reflect.code
Class CtCatchVariableImpl<T>
- java.lang.Object
-
- spoon.support.reflect.declaration.CtElementImpl
-
- spoon.support.reflect.code.CtCodeElementImpl
-
- spoon.support.reflect.code.CtCatchVariableImpl<T>
-
- All Implemented Interfaces:
Serializable
,Cloneable
,FactoryAccessor
,CtCatchVariable<T>
,CtCodeElement
,SourcePositionHolder
,CtElement
,CtModifiable
,CtMultiTypedElement
,CtNamedElement
,CtTypedElement<T>
,CtVariable<T>
,CtQueryable
,CtVisitable
public class CtCatchVariableImpl<T> extends CtCodeElementImpl implements CtCatchVariable<T>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class spoon.support.reflect.declaration.CtElementImpl
ERROR_MESSAGE_TO_STRING, factory, LOGGER, parent
-
-
Constructor Summary
Constructors Constructor Description CtCatchVariableImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(CtVisitor visitor)
Accepts a visitor<C extends CtModifiable>
CaddModifier(ModifierKind modifier)
add a modifier<T extends CtMultiTypedElement>
TaddMultiType(CtTypeReference<?> type)
Adds a type for the element.CtCatchVariable<T>
clone()
Clone the element which calls this method in a new object.CtExpression<T>
getDefaultExpression()
Gets the initialization expression assigned to the variable (also known as the initializer), when declared.Set<CtExtendedModifier>
getExtendedModifiers()
Set<ModifierKind>
getModifiers()
Returns the modifiers of this element, excluding annotations.List<CtTypeReference<?>>
getMultiTypes()
Gets all types of the element.CtCatchVariableReference<T>
getReference()
Returns the corresponding reference.String
getSimpleName()
Returns the simple (unqualified) name of this element.CtTypeReference<T>
getType()
Returns type reference of the exception variable in a catch.ModifierKind
getVisibility()
Gets the visibility of this modifiable element.boolean
hasModifier(ModifierKind modifier)
Tells if this element contains the given modifier.boolean
isAbstract()
Returns true if it contains an abstract modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isFinal()
Returns true if it contains a final modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isNative()
Returns true if it contains a native modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isPartOfJointDeclaration()
Returns true it the variable (field, localvariable) is jointly declared with a share type Eg int a,b; Warning: is computed on demandboolean
isPrivate()
Returns true if it contains a private modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isProtected()
Returns true if it contains a protected modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isPublic()
Returns true if it contains a public modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isStatic()
Returns true if it contains a static modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isStrictfp()
Returns true if it contains a strictfp modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isSynchronized()
Returns true if it contains a synchronized modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isTransient()
Returns true if it contains a transient modifier (seeCtModifiable.hasModifier(ModifierKind)
)boolean
isVolatile()
Returns true if it contains a volatile modifier (seeCtModifiable.hasModifier(ModifierKind)
)<C extends CtModifiable>
CremoveModifier(ModifierKind modifier)
remove a modifierboolean
removeMultiType(CtTypeReference<?> ref)
Removes a type for the element.<C extends CtVariable<T>>
CsetDefaultExpression(CtExpression<T> defaultExpression)
Sets the initialization expression assigned to the variable, when declared.<C extends CtModifiable>
CsetExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)
<C extends CtModifiable>
CsetModifiers(Set<ModifierKind> modifiers)
Sets the modifiers.<T extends CtMultiTypedElement>
TsetMultiTypes(List<CtTypeReference<?>> types)
Adds a type for the element.<C extends CtNamedElement>
CsetSimpleName(String simpleName)
Sets the simple (unqualified) name of this element.<C extends CtTypedElement>
CsetType(CtTypeReference<T> type)
Sets this element's type.<C extends CtModifiable>
CsetVisibility(ModifierKind visibility)
Sets the visibility of this modifiable element (replaces old visibility).-
Methods inherited from class spoon.support.reflect.code.CtCodeElementImpl
partiallyEvaluate
-
Methods inherited from class spoon.support.reflect.declaration.CtElementImpl
addAnnotation, addComment, asIterable, comment, delete, descendantIterator, emptyList, emptySet, equals, filterChildren, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getFactory, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hashCode, hasParent, isImplicit, isParentInitialized, map, map, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, unmodifiableList, updateAllParentsBelow
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
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.visitor.chain.CtQueryable
filterChildren, map, map
-
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
-
-
-
Method Detail
-
accept
public void accept(CtVisitor visitor)
Description copied from interface:CtVisitable
Accepts a visitor- Specified by:
accept
in interfaceCtVisitable
-
getDefaultExpression
public CtExpression<T> getDefaultExpression()
Description copied from interface:CtVariable
Gets the initialization expression assigned to the variable (also known as the initializer), when declared.- Specified by:
getDefaultExpression
in interfaceCtVariable<T>
-
getReference
public CtCatchVariableReference<T> getReference()
Description copied from interface:CtNamedElement
Returns the corresponding reference.- Specified by:
getReference
in interfaceCtCatchVariable<T>
- Specified by:
getReference
in interfaceCtNamedElement
- Specified by:
getReference
in interfaceCtVariable<T>
-
getSimpleName
public String getSimpleName()
Description copied from interface:CtNamedElement
Returns the simple (unqualified) name of this element.- Specified by:
getSimpleName
in interfaceCtNamedElement
-
getType
public CtTypeReference<T> getType()
Description copied from interface:CtCatchVariable
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 interfaceCtCatchVariable<T>
- Specified by:
getType
in interfaceCtTypedElement<T>
-
setDefaultExpression
public <C extends CtVariable<T>> C setDefaultExpression(CtExpression<T> defaultExpression)
Description copied from interface:CtVariable
Sets the initialization expression assigned to the variable, when declared.- Specified by:
setDefaultExpression
in interfaceCtCatchVariable<T>
- Specified by:
setDefaultExpression
in interfaceCtVariable<T>
-
isPartOfJointDeclaration
public boolean isPartOfJointDeclaration()
Description copied from interface:CtVariable
Returns true it the variable (field, localvariable) is jointly declared with a share type Eg int a,b; Warning: is computed on demand- Specified by:
isPartOfJointDeclaration
in interfaceCtVariable<T>
-
setSimpleName
public <C extends CtNamedElement> C setSimpleName(String simpleName)
Description copied from interface:CtNamedElement
Sets the simple (unqualified) name of this element.- Specified by:
setSimpleName
in interfaceCtNamedElement
-
setType
public <C extends CtTypedElement> C setType(CtTypeReference<T> type)
Description copied from interface:CtTypedElement
Sets this element's type.- Specified by:
setType
in interfaceCtCatchVariable<T>
- Specified by:
setType
in interfaceCtTypedElement<T>
-
addMultiType
public <T extends CtMultiTypedElement> T addMultiType(CtTypeReference<?> type)
Description copied from interface:CtMultiTypedElement
Adds a type for the element.- Specified by:
addMultiType
in interfaceCtMultiTypedElement
-
removeMultiType
public boolean removeMultiType(CtTypeReference<?> ref)
Description copied from interface:CtMultiTypedElement
Removes a type for the element.- Specified by:
removeMultiType
in interfaceCtMultiTypedElement
-
getMultiTypes
public List<CtTypeReference<?>> getMultiTypes()
Description copied from interface:CtMultiTypedElement
Gets all types of the element.- Specified by:
getMultiTypes
in interfaceCtMultiTypedElement
-
setMultiTypes
public <T extends CtMultiTypedElement> T setMultiTypes(List<CtTypeReference<?>> types)
Description copied from interface:CtMultiTypedElement
Adds a type for the element.- Specified by:
setMultiTypes
in interfaceCtMultiTypedElement
-
getModifiers
public Set<ModifierKind> getModifiers()
Description copied from interface:CtModifiable
Returns the modifiers of this element, excluding annotations. Implicit modifiers, such as thepublic
andstatic
modifiers of interface members, are included.- Specified by:
getModifiers
in interfaceCtModifiable
- Returns:
- the modifiers of this declaration in undefined order; an empty set if there are none
-
hasModifier
public boolean hasModifier(ModifierKind modifier)
Description copied from interface:CtModifiable
Tells if this element contains the given modifier.- Specified by:
hasModifier
in interfaceCtModifiable
- Parameters:
modifier
- to search- Returns:
true
if this element contain the modifier
-
setModifiers
public <C extends CtModifiable> C setModifiers(Set<ModifierKind> modifiers)
Description copied from interface:CtModifiable
Sets the modifiers.- Specified by:
setModifiers
in interfaceCtModifiable
-
addModifier
public <C extends CtModifiable> C addModifier(ModifierKind modifier)
Description copied from interface:CtModifiable
add a modifier- Specified by:
addModifier
in interfaceCtModifiable
-
removeModifier
public <C extends CtModifiable> C removeModifier(ModifierKind modifier)
Description copied from interface:CtModifiable
remove a modifier- Specified by:
removeModifier
in interfaceCtModifiable
-
setVisibility
public <C extends CtModifiable> C setVisibility(ModifierKind visibility)
Description copied from interface:CtModifiable
Sets the visibility of this modifiable element (replaces old visibility).- Specified by:
setVisibility
in interfaceCtModifiable
-
getVisibility
public ModifierKind getVisibility()
Description copied from interface:CtModifiable
Gets the visibility of this modifiable element.- Specified by:
getVisibility
in interfaceCtModifiable
-
getExtendedModifiers
public Set<CtExtendedModifier> getExtendedModifiers()
- Specified by:
getExtendedModifiers
in interfaceCtModifiable
- Returns:
- the set of extended modifiers (those incl. implicit).
-
setExtendedModifiers
public <C extends CtModifiable> C setExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)
- Specified by:
setExtendedModifiers
in interfaceCtModifiable
-
clone
public 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 interfaceCtCatchVariable<T>
- Specified by:
clone
in interfaceCtCodeElement
- Specified by:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtNamedElement
- Overrides:
clone
in classCtCodeElementImpl
-
isPublic
public boolean isPublic()
Description copied from interface:CtModifiable
Returns true if it contains a public modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isPublic
in interfaceCtModifiable
-
isPrivate
public boolean isPrivate()
Description copied from interface:CtModifiable
Returns true if it contains a private modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isPrivate
in interfaceCtModifiable
-
isProtected
public boolean isProtected()
Description copied from interface:CtModifiable
Returns true if it contains a protected modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isProtected
in interfaceCtModifiable
-
isFinal
public boolean isFinal()
Description copied from interface:CtModifiable
Returns true if it contains a final modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isFinal
in interfaceCtModifiable
-
isStatic
public boolean isStatic()
Description copied from interface:CtModifiable
Returns true if it contains a static modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isStatic
in interfaceCtModifiable
-
isAbstract
public boolean isAbstract()
Description copied from interface:CtModifiable
Returns true if it contains an abstract modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isAbstract
in interfaceCtModifiable
-
isTransient
public boolean isTransient()
Description copied from interface:CtModifiable
Returns true if it contains a transient modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isTransient
in interfaceCtModifiable
-
isVolatile
public boolean isVolatile()
Description copied from interface:CtModifiable
Returns true if it contains a volatile modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isVolatile
in interfaceCtModifiable
-
isSynchronized
public boolean isSynchronized()
Description copied from interface:CtModifiable
Returns true if it contains a synchronized modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isSynchronized
in interfaceCtModifiable
-
isNative
public boolean isNative()
Description copied from interface:CtModifiable
Returns true if it contains a native modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isNative
in interfaceCtModifiable
-
isStrictfp
public boolean isStrictfp()
Description copied from interface:CtModifiable
Returns true if it contains a strictfp modifier (seeCtModifiable.hasModifier(ModifierKind)
)- Specified by:
isStrictfp
in interfaceCtModifiable
-
-