Package de.aristaflow.adept2.util
Class ThrowableTools
- java.lang.Object
-
- de.aristaflow.adept2.util.ThrowableTools
-
public class ThrowableTools extends Object
This class provides tool methods for handlingThrowable
.
-
-
Constructor Summary
Constructors Constructor Description ThrowableTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Throwable
merge(Collection<Throwable> throwables)
Merges the designated throwables by selecting the first most critical throwable (Error
,Exception
orRuntimeException
), adds all other throwables as suppressed to the selected throwable and returns the selected one.static <T extends Throwable>
Tmerge(T selected, Collection<Throwable> throwables)
Adds the designated throwables as suppressed ones to the designated selected throwable.
-
-
-
Method Detail
-
merge
public static Throwable merge(Collection<Throwable> throwables)
Merges the designated throwables by selecting the first most critical throwable (Error
,Exception
orRuntimeException
), adds all other throwables as suppressed to the selected throwable and returns the selected one.- Parameters:
throwables
- The throwables which to merge to one throwable which will be the most critical one from the list.- Returns:
- The first occurring most critical throwable from the designated throwables with all other throwables as suppressed ones.
-
merge
public static <T extends Throwable> T merge(T selected, Collection<Throwable> throwables)
Adds the designated throwables as suppressed ones to the designated selected throwable. If the selected one is in the collection, it will not be considered again.- Parameters:
selected
- The selected throwable to which to add the designated other throwables.throwables
- The throwables which to add as suppressed ones to the designated selected exception. If the selected one is in the collection, it will not be considered again.- Returns:
- The designated selected throwable having the other designated throwables as suppressed ones.
-
-