Package org.storynode.pigeon.function
Class NeverThrow
java.lang.Object
org.storynode.pigeon.function.NeverThrow
Static functions for exception-less execution
- Since:
- 1.0.0
- Author:
- Andrea Coronese
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRuns the given function and returns aResultdescribing its outcomeexecuting(ThrowingSupplier<T> func) Runs the given function and returns aResultwith the function returned value
-
Constructor Details
-
NeverThrow
public NeverThrow()
-
-
Method Details
-
executing
Runs the given function and returns aResultdescribing its outcome -
executing
@NotNull public static <T> @NotNull Result<T,? extends Throwable> executing(ThrowingSupplier<T> func) Runs the given function and returns aResultwith the function returned value- Type Parameters:
T- the type of the return value- Parameters:
func- a function to run- Returns:
- a
Resultobject that will contain the function return value if the execution completed nominally or the error thrown if completed exceptionally.
-