Package eu.ciechanowiec.conditional
Class ExceptionThrowerVoid
- java.lang.Object
-
- eu.ciechanowiec.conditional.ExceptionThrowerVoid
-
- All Implemented Interfaces:
ExceptionThrower
class ExceptionThrowerVoid extends Object implements ExceptionThrower
Entity that does nothing when an implemented method is called.
-
-
Constructor Summary
Constructors Constructor Description ExceptionThrowerVoid()Constructs an instance of aExceptionThrowerVoid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Exception>
voidthrowIfActive(T exceptionToThrowOrSwallow)Throws the passedExceptionif this exception thrower is of active type.
-
-
-
Constructor Detail
-
ExceptionThrowerVoid
ExceptionThrowerVoid()
Constructs an instance of aExceptionThrowerVoid.
-
-
Method Detail
-
throwIfActive
public <T extends Exception> void throwIfActive(@Nullable 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.- Specified by:
throwIfActivein interfaceExceptionThrower- 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 typeT extends Exception
-
-