Package eu.ciechanowiec.conditional
Interface ExceptionThrower
-
- All Known Implementing Classes:
ExceptionThrowerActive,ExceptionThrowerVoid
interface ExceptionThrowerEntity that throws or swallows passedExceptions, depending on the implementation.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T extends Exception>
voidthrowIfActive(T exceptionToThrowOrSwallow)Throws the passedExceptionif this exception thrower is of active type.
-
-
-
Method Detail
-
throwIfActive
default <T extends Exception> void throwIfActive(T exceptionToThrowOrSwallow) throws T extends Exception
Throws the passedExceptionif this exception thrower is of active type.Otherwise, the passed
Exceptionis swallowed, i.e. the call of this method has no effects.- Type Parameters:
T- type of the passed exception- Parameters:
exceptionToThrowOrSwallow- exception to be thrown or swallowed- Throws:
T- if this exception thrower is of active typeUnsupportedOperationException- if this method hasn't been implemented by this exception throwerT extends Exception
-
-