Module java.base
Package java.lang.classfile.instructionPREVIEW

# Interface SwitchCase

public sealed interface SwitchCase
`SwitchCase` is a preview API of the Java platform.
Programs can only use `SwitchCase` 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 single case in a `lookupswitch` or `tableswitch` instruction.

Since:
  22
See Also:
  - `LookupSwitchInstruction`PREVIEW
  - `TableSwitchInstruction`PREVIEW

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `caseValue()`
  Returns the integer value corresponding to this case.
  `static SwitchCasePREVIEW`
  `of(int caseValue, LabelPREVIEW target)`
  Create a SwitchCasePREVIEW
  `LabelPREVIEW`
  `target()`
  Returns the branch target corresponding to this case.

- ## Method Details

  - ### caseValue

    int caseValue()
    Returns the integer value corresponding to this case.
    Returns:
      the integer value corresponding to this case

  - ### target

    LabelPREVIEW target()
    Returns the branch target corresponding to this case.
    Returns:
      the branch target corresponding to this case

  - ### of

    static SwitchCasePREVIEW of(int caseValue, LabelPREVIEW target)
    Create a SwitchCasePREVIEW
    Parameters:
      `caseValue` - the integer value for the case
      `target` - the branch target for the case
    Returns:
      the SwitchCasePREVIEW