Interface ExceptionCauseTrigger<T extends Throwable>

Type Parameters:
T - the type of the throwable thrown by the trigger
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ExceptionCauseTrigger<T extends Throwable>
Functional interface that represents a trigger function that throws a checked exception of type T when activated. It resembles a TypedTrigger but its intent is to declare a block that contains an exception, so that it can be thrown at different stages without duplication. For example, you can include logging and a throw statement in a single block.

It is also useful for wrapping checked exceptions in contexts where explicit exception handling would clutter the code, such as in lambda expressions or method references.

Since:
0.1.0
Author:
Yoham Gabriel B.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    causedBy(T cause)
    Activates the trigger function, throwing the supplied exception of type T.
  • Method Details

    • causedBy

      void causedBy(T cause)
      Activates the trigger function, throwing the supplied exception of type T.
      Parameters:
      cause - the exception to be passed to the internal throw in the ExceptionCauseTrigger.