Package spoon.reflect.code
Interface CtAbstractSwitch<S>
- Type Parameters:
S
- the type of the selector expression
- All Superinterfaces:
Cloneable
,CtElement
,CtQueryable
,CtVisitable
,FactoryAccessor
,Serializable
,SourcePositionHolder
- All Known Subinterfaces:
CtSwitch<S>
,CtSwitchExpression<T,S>
- All Known Implementing Classes:
CtSwitchExpressionImpl
,CtSwitchImpl
This code element defines an abstract switch
(either switch statement or switch expression).
-
Method Summary
Modifier and TypeMethodDescription<T extends CtAbstractSwitch<S>>
TAdds a case;<T extends CtAbstractSwitch<S>>
TAdds a case at the specified position.getCases()
Gets the list of cases defined for this switch.Gets the selector.boolean
removeCase(CtCase<? super S> c)
Removes a case;<T extends CtAbstractSwitch<S>>
TSets the list of cases defined for this switch.<T extends CtAbstractSwitch<S>>
TsetSelector(CtExpression<S> selector)
Sets the selector.Methods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, clone, 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.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getSelector
CtExpression<S> getSelector()Gets the selector. The type of the Expression must bechar
,byte
,short
,int
,Character
,Byte
,Short
,Integer
, or anenum
type -
setSelector
Sets the selector. The type of the Expression must bechar
,byte
,short
,int
,Character
,Byte
,Short
,Integer
, or anenum
type -
getCases
Gets the list of cases defined for this switch. -
setCases
Sets the list of cases defined for this switch. -
addCase
Adds a case; -
addCaseAt
Adds a case at the specified position.- Type Parameters:
T
- type of the switch -CtSwitch
orCtSwitchExpression
- Parameters:
position
- index at which the case needs to be insertedc
- case which has to be inserted in the switch block- Returns:
- switch block in which the case is inserted
-
removeCase
Removes a case;
-