Interface SwitchBlock

  • All Known Implementing Classes:
    SwitchBlockImpl

    public interface SwitchBlock
    Support for building the equivalent of a Java switch statement.
    • Method Detail

      • addCase

        void addCase​(int caseValue,
                     boolean jumpToEnd,
                     InstructionBuilderCallback callback)
        Adds a handler for a particular case value. This method should only be invoked at most once for each case value.
        Parameters:
        caseValue - value to match
        jumpToEnd - true if a jump to the end should be provided, or false if either the callback generated a return opcode, or it is desired to "drop down" into the next case handler. The last case handled drop down out of the SwitchBlock.
        callback - provides the logic for the specified case
      • addDefault

        void addDefault​(InstructionBuilderCallback callback)
        Adds the default handler. This is optional, and is only allowed after all cases have been added. The default handler automatically throws an IllegalArgumentException.
        Parameters:
        callback - provides the logic for the default handler case.