Package org.apache.tapestry5.internal.plastic

## Class TryCatchBlockImpl

- java.lang.Object
- - org.apache.tapestry5.internal.plastic.Lockable
  - - org.apache.tapestry5.internal.plastic.TryCatchBlockImpl

- All Implemented Interfaces:
    `TryCatchBlock`

      public class TryCatchBlockImpl
      extends Lockable
      implements TryCatchBlock

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addCatch​(java.lang.String exceptionClassName, InstructionBuilderCallback callback)` | Ends the block (if not already ended) and inserts a catch block for the named exception.
    `void` | `addFinally​(InstructionBuilderCallback callback)` | As with `TryCatchBlock.addCatch(String, InstructionBuilderCallback)`, but the exception caught is null, which acts as a finally block in the Java language.
    `void` | `addTry​(InstructionBuilderCallback callback)` | Invoked first, to generate the code in which exceptions may be caught.

    - ### Methods inherited from class org.apache.tapestry5.internal.plastic.Lockable

      `check, lock`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### addTry

          public void addTry​(InstructionBuilderCallback callback)

      Description copied from interface: `TryCatchBlock`
      Invoked first, to generate the code in which exceptions may be caught.
      Specified by:
        `addTry` in interface `TryCatchBlock`

    - #### addCatch

          public void addCatch​(java.lang.String exceptionClassName,
                               InstructionBuilderCallback callback)

      Description copied from interface: `TryCatchBlock`
      Ends the block (if not already ended) and inserts a catch block for the named exception. The InstructionBuilder is returned so that the code for handling the exception can be added. The exception object will be on top of the stack. This should be called after `TryCatchBlock.addTry(InstructionBuilderCallback)`. Note: no attempt is made currently to sort the handlers; for example adding a catch for java.lang.Exception first will mean that more specific exception handlers added later will never be invoked.
      Specified by:
        `addCatch` in interface `TryCatchBlock`
      Parameters:
        `exceptionClassName` - caught exception class
        `callback` - that implements the logic of the catch block

    - #### addFinally

          public void addFinally​(InstructionBuilderCallback callback)

      Description copied from interface: `TryCatchBlock`
      As with `TryCatchBlock.addCatch(String, InstructionBuilderCallback)`, but the exception caught is null, which acts as a finally block in the Java language. This must be called last (after `TryCatchBlock.addTry(InstructionBuilderCallback)` and any calls to `TryCatchBlock.addCatch(String, InstructionBuilderCallback)`.
      Specified by:
        `addFinally` in interface `TryCatchBlock`
      Parameters:
        `callback` - implements the logic of the finally block