Package de.aristaflow.adept2.util
Class ThrowableTools
java.lang.Object
de.aristaflow.adept2.util.ThrowableTools
This class provides tool methods for handling
Throwable.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Throwablemerge(Collection<Throwable> throwables) Merges the designated throwables by selecting the first most critical throwable (Error,ExceptionorRuntimeException), 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.
-
Constructor Details
-
ThrowableTools
public ThrowableTools()
-
-
Method Details
-
merge
Merges the designated throwables by selecting the first most critical throwable (Error,ExceptionorRuntimeException), 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
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.
-