Interface TableSwitchInstruction

All Superinterfaces:
ClassFileElementPREVIEW, CodeElementPREVIEW, InstructionPREVIEW

public sealed interface TableSwitchInstruction extends InstructionPREVIEW
TableSwitchInstruction is a preview API of the Java platform.
Programs can only use TableSwitchInstruction when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a tableswitch instruction in the code array of a Code attribute. Delivered as a CodeElementPREVIEW when traversing the elements of a CodeModelPREVIEW.
Since:
22
  • Method Details

    • lowValue

      int lowValue()
      Returns the low value of the switch target range, inclusive.
      Returns:
      the low value of the switch target range, inclusive
    • highValue

      int highValue()
      Returns the high value of the switch target range, inclusive.
      Returns:
      the high value of the switch target range, inclusive
    • defaultTarget

      LabelPREVIEW defaultTarget()
      Returns the default target of the switch.
      Returns:
      the default target of the switch
    • cases

      Returns the cases of the switch.
      Returns:
      the cases of the switch
    • of

      static TableSwitchInstructionPREVIEW of(int lowValue, int highValue, LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases)
      Returns a table switch instruction.
      Parameters:
      lowValue - the low value of the switch target range, inclusive
      highValue - the high value of the switch target range, inclusive
      defaultTarget - the default target of the switch
      cases - the cases of the switch
      Returns:
      a table switch instruction