APIdia Launch Partner
Top Description Methods
java.lang.classfile.instruction

public sealed Interface LookupSwitchInstruction

extends Instruction
permits BoundLookupSwitchInstruction, UnboundLookupSwitchInstruction
Known Direct Implementers
jdk.internal.classfile.impl.AbstractInstruction.BoundLookupSwitchInstruction, jdk.internal.classfile.impl.AbstractInstruction.UnboundLookupSwitchInstruction
Imports
java.lang.classfile.CodeBuilder, .CodeElement, .CodeModel, .Instruction, .Label, .Opcode, java.util.List, jdk.internal.classfile.impl.AbstractInstruction

Models a lookupswitch instruction in the code array of a Code attribute. Delivered as a CodeElement when traversing the elements of a CodeModel.

A lookup switch instruction is composite:

LookupSwitchInstruction( Label defaultTarget, List<SwitchCase> cases )
LookupSwitchInstruction(
    Label defaultTarget,
    List<SwitchCase> cases
)
If elements in cases are not sorted ascending by their caseValue, a sorted version of the cases list will be written instead.
Since
24
Java Virtual Machine Specification
6.5.lookupswitch lookupswitch
See Also
Opcode.Kind#LOOKUP_SWITCH, CodeBuilder::lookupswitch

Method Summary

Modifier and TypeMethod and Description
public List<SwitchCase>

Returns:

the cases of the switch
cases
()

Returns the cases of the switch.

public Label

Returns:

the target of the default case
defaultTarget
()

Returns the target of the default case.

public static LookupSwitchInstruction

Returns:

a lookup switch instruction
of
(Label
the default target of the switch
defaultTarget
,
List<SwitchCase>
the cases of the switch
cases
)

Returns a lookup switch instruction.

Inherited from java.lang.classfile.Instruction:
opcodesizeInBytes

Method Detail

casesback to summary
public List<SwitchCase> cases()

Returns the cases of the switch.

Returns:List<SwitchCase>

the cases of the switch

defaultTargetback to summary
public Label defaultTarget()

Returns the target of the default case.

Returns:Label

the target of the default case

ofback to summary
public static LookupSwitchInstruction of(Label defaultTarget, List<SwitchCase> cases)

Returns a lookup switch instruction.

Parameters
defaultTarget:Label

the default target of the switch

cases:List<SwitchCase>

the cases of the switch

Returns:LookupSwitchInstruction

a lookup switch instruction