# Interface MonitorInstruction

All Superinterfaces:
  `ClassFileElement, CodeElement, Instruction`

public sealed interface MonitorInstruction extends Instruction
Models a `monitorenter` or `monitorexit` instruction in the `code` array of a `Code` attribute. Corresponding opcodes have a kind of `Opcode.Kind.MONITOR`. Delivered as a `CodeElement` when traversing the elements of a `CodeModel`.

A monitor instruction is composite:

    MonitorInstruction(Opcode opcode)

Since:
  24

- ## Method Summary

  Static Methods
  Modifier and Type
  Method
  Description
  `static MonitorInstruction`
  `of(Opcode op)`
  Returns a monitor instruction.

  ### Methods declared in interface Instruction

  `opcode, sizeInBytes`
  Modifier and Type
  Method
  Description
  `Opcode`
  `opcode()`
  Returns the operation of this instruction.
  `int`
  `sizeInBytes()`
  Returns the size in bytes of this instruction.

- ## Method Details

  - ### of

    static MonitorInstruction of(Opcode op)
    Returns a monitor instruction.
    Parameters:
      `op` - the opcode for the specific type of monitor instruction, which must be of kind `Opcode.Kind.MONITOR`
    Returns:
      a monitor instruction
    Throws:
      `IllegalArgumentException` - if the opcode kind is not `Opcode.Kind.MONITOR`.