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(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 withTryCatchBlock.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.
-
-
-
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 interfaceTryCatchBlock
-
addCatch
public void addCatch(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 afterTryCatchBlock.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 interfaceTryCatchBlock
- Parameters:
exceptionClassName
- caught exception classcallback
- that implements the logic of the catch block
-
addFinally
public void addFinally(InstructionBuilderCallback callback)
Description copied from interface:TryCatchBlock
As withTryCatchBlock.addCatch(String, InstructionBuilderCallback)
, but the exception caught is null, which acts as a finally block in the Java language. This must be called last (afterTryCatchBlock.addTry(InstructionBuilderCallback)
and any calls toTryCatchBlock.addCatch(String, InstructionBuilderCallback)
.- Specified by:
addFinally
in interfaceTryCatchBlock
- Parameters:
callback
- implements the logic of the finally block
-
-