Class TryAndLog
- java.lang.Object
-
- dev.pcvolkmer.mv64e.datamapper.mapper.exceptionhandler.TryAndLog
-
public class TryAndLog extends java.lang.ObjectStatic methods to build a try/catch chain.- Since:
- 0.2
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TrytryAndLog(java.lang.Runnable runnable)Executes runnable and returns Try for further processing.static TrytryAndLog(java.lang.Runnable runnable, org.slf4j.Logger logger)Executes runnable and returns Try for further processing.static <T> TryWithResult<T>tryAndLogWithResult(java.util.function.Supplier<T> supplier)Executes supplier and returns TryWithResult to build a try/catch chain.static <T> TryWithResult<T>tryAndLogWithResult(java.util.function.Supplier<T> supplier, org.slf4j.Logger logger)Executes supplier and returns TryWithResult to build a try/catch chain.
-
-
-
Method Detail
-
tryAndLogWithResult
public static <T> TryWithResult<T> tryAndLogWithResult(java.util.function.Supplier<T> supplier)
Executes supplier and returns TryWithResult to build a try/catch chain.- Type Parameters:
T- The type of the supplied value- Parameters:
supplier- The supplier to be executed- Returns:
- TryWithResult for further processing
-
tryAndLogWithResult
public static <T> TryWithResult<T> tryAndLogWithResult(java.util.function.Supplier<T> supplier, org.slf4j.Logger logger)
Executes supplier and returns TryWithResult to build a try/catch chain.- Type Parameters:
T- The type of the supplied value- Parameters:
supplier- The supplier to be executedlogger- The logger to be used for logging the exception message- Returns:
- TryWithResult for further processing
-
tryAndLog
public static Try tryAndLog(java.lang.Runnable runnable)
Executes runnable and returns Try for further processing.- Parameters:
runnable- The runnable to be executed- Returns:
- TryWithResult for further processing
-
tryAndLog
public static Try tryAndLog(java.lang.Runnable runnable, org.slf4j.Logger logger)
Executes runnable and returns Try for further processing.- Parameters:
runnable- The runnable to be executedlogger- The logger to be used for logging the exception message- Returns:
- TryWithResult for further processing
-
-