- All Superinterfaces:
BodyCreator
A creator for a
try-catch-finally construct.-
Method Summary
Modifier and TypeMethodDescriptionvoidbody(Consumer<BlockCreator> builder) Build the body of thetrystatement.voidcatch_(Class<? extends Throwable> type, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause which receives the thrown exception.default voidcatch_(ClassDesc type, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause which receives the thrown exception.voidcatch_(ClassDesc superType, Set<ClassDesc> types, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause for multiple throwable types which receives the thrown exception.voidcatch_(Set<Class<? extends Throwable>> types, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause for multiple throwable types which receives the thrown exception.voidfinally_(Consumer<BlockCreator> builder) Add thefinallyclause.
-
Method Details
-
body
Build the body of thetrystatement.- Specified by:
bodyin interfaceBodyCreator- Parameters:
builder- the builder (must not benull)
-
catch_
default void catch_(ClassDesc type, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause which receives the thrown exception.- Parameters:
type- the descriptor of the exception type to catch (must not benull)caughtName- the name of the caught exception variable (must not benull)builder- the builder for the catch block (must not benull)
-
catch_
void catch_(ClassDesc superType, Set<ClassDesc> types, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause for multiple throwable types which receives the thrown exception.- Parameters:
superType- the common supertype of all the given types (must not benull)types- the exception types to catch (must not benull)caughtName- the name of the caught exception variable (must not benull)builder- the builder for the catch block (must not benull)
-
catch_
void catch_(Class<? extends Throwable> type, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause which receives the thrown exception.- Parameters:
type- the exception type to catch (must not benull)caughtName- the name of the caught exception variable (must not benull)builder- the builder for the catch block (must not benull)
-
catch_
void catch_(Set<Class<? extends Throwable>> types, String caughtName, BiConsumer<BlockCreator, ? super LocalVar> builder) Add a catch clause for multiple throwable types which receives the thrown exception.- Parameters:
types- the exception types to catch (must not benull)caughtName- the name of the caught exception variable (must not benull)builder- the builder for the catch block (must not benull)
-
finally_
Add thefinallyclause. Note that the builder will be called multiple times if there are multiple exit points to the method (which is usually the case).- Parameters:
builder- the builder for thefinallyblock (must not benull)
-