Package org.jboss.classfilewriter.code
Class TableSwitchBuilder
- java.lang.Object
-
- org.jboss.classfilewriter.code.TableSwitchBuilder
-
public class TableSwitchBuilder extends java.lang.Object
builder class used to build a tableswitch statement.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableSwitchBuilder.ValuePair
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<BranchEnd>
defaultBranchEnd
private CodeLocation
defaultLocation
private int
high
private int
low
private java.util.List<TableSwitchBuilder.ValuePair>
values
-
Constructor Summary
Constructors Constructor Description TableSwitchBuilder(int low, int high)
Builds a lookup switch statement with no specified default location.TableSwitchBuilder(CodeLocation defaultLocation, int low, int high)
Builds a lookup switch statement, specifying the default location
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.atomic.AtomicReference<BranchEnd>
add()
Adds a value to the table that is at a location yet to be written.TableSwitchBuilder
add(CodeLocation location)
Adds a value to the tablejava.util.concurrent.atomic.AtomicReference<BranchEnd>
getDefaultBranchEnd()
CodeLocation
getDefaultLocation()
int
getHigh()
int
getLow()
java.util.List<TableSwitchBuilder.ValuePair>
getValues()
-
-
-
Field Detail
-
defaultLocation
private final CodeLocation defaultLocation
-
defaultBranchEnd
private final java.util.concurrent.atomic.AtomicReference<BranchEnd> defaultBranchEnd
-
values
private final java.util.List<TableSwitchBuilder.ValuePair> values
-
low
private final int low
-
high
private final int high
-
-
Constructor Detail
-
TableSwitchBuilder
public TableSwitchBuilder(int low, int high)
Builds a lookup switch statement with no specified default location. When the lookup switch is added to the code attribute aBranchEnd
will be returned that can be used to set the location.- Parameters:
low
-high
-
-
TableSwitchBuilder
public TableSwitchBuilder(CodeLocation defaultLocation, int low, int high)
Builds a lookup switch statement, specifying the default location- Parameters:
defaultLocation
- The default locationlow
-high
-
-
-
Method Detail
-
add
public java.util.concurrent.atomic.AtomicReference<BranchEnd> add()
Adds a value to the table that is at a location yet to be written. After this lookup switch has been written then the BranchEnd can be retrieved from the returned reference.- Returns:
- A reference to the BranchEnd that will be created.
-
add
public TableSwitchBuilder add(CodeLocation location)
Adds a value to the table
-
getDefaultLocation
public CodeLocation getDefaultLocation()
-
getDefaultBranchEnd
public java.util.concurrent.atomic.AtomicReference<BranchEnd> getDefaultBranchEnd()
-
getValues
public java.util.List<TableSwitchBuilder.ValuePair> getValues()
-
getLow
public int getLow()
-
getHigh
public int getHigh()
-
-