Package io.smallrye.mutiny.unchecked
Class Unchecked
- java.lang.Object
-
- io.smallrye.mutiny.unchecked.Unchecked
-
public class Unchecked extends java.lang.Object
Provides wrapper to handle functions / consumers / suppliers that throw checked exceptions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,U>
java.util.function.BiConsumer<T,U>consumer(UncheckedBiConsumer<T,U> consumer)
Transforms the given (unchecked) bi-consumer into a regular bi-consumer.static <T> java.util.function.Consumer<T>
consumer(UncheckedConsumer<T> consumer)
Transforms the given (unchecked) consumer into a regular consumer.static <T,U,R>
java.util.function.BiFunction<T,U,R>function(UncheckedBiFunction<T,U,R> function)
Transforms the given (unchecked) bi-function into a regular bi-function.static <T,R>
java.util.function.Function<T,R>function(UncheckedFunction<T,R> function)
Transforms the given (unchecked) function into a regular function.static <T> java.util.function.Supplier<T>
supplier(UncheckedSupplier<T> supplier)
Transforms the given (unchecked) supplier into a regular supplier.static <T,U>
UncheckedBiConsumer<T,U>unchecked(java.util.function.BiConsumer<T,U> consumer)
Transforms the given bi-consumer into a version that can throw exceptions.static <T,U,R>
UncheckedBiFunction<T,U,R>unchecked(java.util.function.BiFunction<T,U,R> function)
Transforms the given bi-function into a version that can throw exceptions.static <T> UncheckedConsumer<T>
unchecked(java.util.function.Consumer<T> consumer)
Transforms the given consumer into a version that can throw exceptions.static <T,R>
UncheckedFunction<T,R>unchecked(java.util.function.Function<T,R> function)
Transforms the given function into a version that can throw exceptions.static <T> UncheckedSupplier<T>
unchecked(java.util.function.Supplier<T> supplier)
Transforms the given supplier into a version that can throw exceptions.
-
-
-
Method Detail
-
unchecked
public static <T,U,R> UncheckedBiFunction<T,U,R> unchecked(java.util.function.BiFunction<T,U,R> function)
Transforms the given bi-function into a version that can throw exceptions.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument to the functionR
- the type of the result of the function- Parameters:
function
- the function- Returns:
- the new
UncheckedBiFunction
-
unchecked
public static <T,R> UncheckedFunction<T,R> unchecked(java.util.function.Function<T,R> function)
Transforms the given function into a version that can throw exceptions.- Type Parameters:
T
- the type of the argument to the functionR
- the type of the result of the function- Parameters:
function
- the function- Returns:
- the new
UncheckedFunction
-
unchecked
public static <T> UncheckedConsumer<T> unchecked(java.util.function.Consumer<T> consumer)
Transforms the given consumer into a version that can throw exceptions.- Type Parameters:
T
- the type of the input to the operation- Parameters:
consumer
- the consumer- Returns:
- the new
UncheckedConsumer
-
unchecked
public static <T,U> UncheckedBiConsumer<T,U> unchecked(java.util.function.BiConsumer<T,U> consumer)
Transforms the given bi-consumer into a version that can throw exceptions.- Type Parameters:
T
- the type of the first argument to the operationU
- the type of the second argument to the operation- Parameters:
consumer
- the consumer- Returns:
- the new
UncheckedBiConsumer
-
unchecked
public static <T> UncheckedSupplier<T> unchecked(java.util.function.Supplier<T> supplier)
Transforms the given supplier into a version that can throw exceptions.- Type Parameters:
T
- the type of items supplied by this supplier- Parameters:
supplier
- the supplier- Returns:
- the new
UncheckedSupplier
-
function
public static <T,R> java.util.function.Function<T,R> function(UncheckedFunction<T,R> function)
Transforms the given (unchecked) function into a regular function. If the operation throws an exception, this exception is rethrown, wrapped into aRuntimeException
if needed.- Type Parameters:
T
- the type of the argument to the functionR
- the type of the result of the function- Parameters:
function
- the function- Returns:
- a
Function
executing theUncheckedFunction
. If the operation throws an exception, the exception is rethrown, wrapped in aRuntimeException
if needed.
-
function
public static <T,U,R> java.util.function.BiFunction<T,U,R> function(UncheckedBiFunction<T,U,R> function)
Transforms the given (unchecked) bi-function into a regular bi-function. If the operation throws an exception, this exception is rethrown, wrapped into aRuntimeException
if needed.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument to the functionR
- the type of the result of the function- Parameters:
function
- the function- Returns:
- a
BiFunction
executing thisUncheckedBiFunction
. If the operation throws an exception, the exception is rethrown, wrapped in aRuntimeException
if needed.
-
consumer
public static <T,U> java.util.function.BiConsumer<T,U> consumer(UncheckedBiConsumer<T,U> consumer)
Transforms the given (unchecked) bi-consumer into a regular bi-consumer. If the operation throws an exception, this exception is rethrown, wrapped into aRuntimeException
if needed.- Type Parameters:
T
- the type of the first argument to the operationU
- the type of the second argument to the operation- Parameters:
consumer
- the consumer- Returns:
- a
BiConsumer
executing thisUncheckedBiConsumer
. If the operation throws an exception, the exception is rethrown, wrapped in aRuntimeException
if needed.
-
consumer
public static <T> java.util.function.Consumer<T> consumer(UncheckedConsumer<T> consumer)
Transforms the given (unchecked) consumer into a regular consumer. If the operation throws an exception, this exception is rethrown, wrapped into aRuntimeException
if needed.- Type Parameters:
T
- the type of the first argument to the operation- Parameters:
consumer
- the consumer- Returns:
- a
Consumer
executing thisUncheckedConsumer
. If the operation throws an exception, the exception is rethrown, wrapped in aRuntimeException
if needed.
-
supplier
public static <T> java.util.function.Supplier<T> supplier(UncheckedSupplier<T> supplier)
Transforms the given (unchecked) supplier into a regular supplier. If the operation throws an exception, this exception is rethrown, wrapped into aRuntimeException
if needed.- Type Parameters:
T
- the type of items supplied by this supplier- Parameters:
supplier
- the supplier- Returns:
- a
Supplier
executing thisUncheckedSupplier
. If the operation throws an exception, the exception is rethrown, wrapped in aRuntimeException
if needed.
-
-