Package org.jboss.classfilewriter.code
Class LookupSwitchBuilder
- java.lang.Object
-
- org.jboss.classfilewriter.code.LookupSwitchBuilder
-
public class LookupSwitchBuilder extends java.lang.Object
builder class used to build a lookupswitch statement.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LookupSwitchBuilder.ValuePair
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<BranchEnd>
defaultBranchEnd
private CodeLocation
defaultLocation
private java.util.List<LookupSwitchBuilder.ValuePair>
values
-
Constructor Summary
Constructors Constructor Description LookupSwitchBuilder()
Builds a lookup switch statement with no specified default location.LookupSwitchBuilder(CodeLocation defaultLocation)
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(int value)
Adds a value to the table that is at a location yet to be written.LookupSwitchBuilder
add(int value, CodeLocation location)
Adds a value to the tablejava.util.concurrent.atomic.AtomicReference<BranchEnd>
getDefaultBranchEnd()
CodeLocation
getDefaultLocation()
java.util.List<LookupSwitchBuilder.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<LookupSwitchBuilder.ValuePair> values
-
-
Constructor Detail
-
LookupSwitchBuilder
public LookupSwitchBuilder()
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.
-
LookupSwitchBuilder
public LookupSwitchBuilder(CodeLocation defaultLocation)
Builds a lookup switch statement, specifying the default location- Parameters:
defaultLocation
- The default location
-
-
Method Detail
-
add
public java.util.concurrent.atomic.AtomicReference<BranchEnd> add(int value)
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.- Parameters:
value
- The value to add to the lookup table- Returns:
- A reference to the BranchEnd that will be created.
-
add
public LookupSwitchBuilder add(int value, CodeLocation location)
Adds a value to the table- Parameters:
value
- The value to add to the lookup table
-
getDefaultLocation
public CodeLocation getDefaultLocation()
-
getDefaultBranchEnd
public java.util.concurrent.atomic.AtomicReference<BranchEnd> getDefaultBranchEnd()
-
getValues
public java.util.List<LookupSwitchBuilder.ValuePair> getValues()
-
-