| com.pnfsoftware.jeb.core.units.code.java.IJavaSwitch |
Java AST interface to represent switch statements. Support for integer keys and
String keys. Limitation: These objects do not support case-block replacement.
A switch-statement consists of an expression, zero or more cases and an optional default case.
Example:
switch(e) case c0: b0 case c1: b1 default: b2
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract void |
addCase(List<Integer> keys, IJavaBlock b)
Add a case to the switch
| ||||||||||
| abstract void | addCase(Map<Integer, String> casekeymap, IJavaBlock b) | ||||||||||
| abstract void | convertToSwitchOnEnum(IJavaExpression updatedSwitchedOnValue, Map<Integer, IJavaField> enummap) | ||||||||||
| abstract void | convertToSwitchOnInteger(IJavaExpression updatedSwitchedOnValue) | ||||||||||
| abstract void | convertToSwitchOnString(IJavaExpression updatedSwitchedOnValue, Map<Integer, String> indexToStringMap) | ||||||||||
| abstract List<? extends IJavaBlock> |
getCaseBodies()
Get the case bodies.
| ||||||||||
| abstract IJavaBlock | getCaseBody(String stringkey) | ||||||||||
| abstract IJavaBlock |
getCaseBody(int key)
Get a case body by key.
| ||||||||||
| abstract SortedSet<Integer> |
getCaseKeys()
Get the list of case keys.
| ||||||||||
| abstract IJavaBlock |
getDefaultBody()
Get the default case block.
| ||||||||||
| abstract Map<Integer, IJavaField> | getEnumMap() | ||||||||||
| abstract Map<Integer, String> | getStringMap() | ||||||||||
| abstract int | getSwitchType() | ||||||||||
| abstract IJavaExpression |
getSwitchedExpression()
Get the expression being switched on.
| ||||||||||
| abstract boolean |
hasDefaultBody()
Determine if the switch block has a default case.
| ||||||||||
| abstract boolean | isSwitchOnEnum() | ||||||||||
| abstract boolean | isSwitchOnInteger() | ||||||||||
| abstract boolean | isSwitchOnString() | ||||||||||
| abstract boolean |
replaceSubElement(IJavaElement oldElement, IJavaElement newElement)
Note: case-replacements are currently not supported.
| ||||||||||
| abstract void |
setDefaultBody(IJavaBlock b)
Set the default case body for the switch.
| ||||||||||
| abstract void |
setSwitchedExpression(IJavaExpression e)
Set the switch expression.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.java.ICompound
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaElement
| |||||||||||
Add a case to the switch
| keys | mandatory list of keys, this list must contain at least one element |
|---|---|
| b | the case body |
Get the case bodies.
Get a case body by key.
| key | case key |
|---|
Get the list of case keys.
Get the default case block.
Get the expression being switched on.
Determine if the switch block has a default case.
Note: case-replacements are currently not supported.
| oldElement | the element to be replaced |
|---|---|
| newElement | the new element |
Set the default case body for the switch.
| b | optional default case body, null to remove the default case |
|---|
Set the switch expression.
| e | mandatory expression |
|---|