public final class CacheUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <K,V> Function<K,V> |
wrapCallableAsFunction(Callable<V> callable)
Wraps the given
Callable into a function that ignores the given parameter. |
static <K,V> Function<K,V> |
wrapSupplierAsFunction(Supplier<V> supplier)
Wraps the given
Supplier into a function that ignores the given parameter. |
@Nonnull public static <K,V> Function<K,V> wrapCallableAsFunction(@Nonnull Callable<V> callable)
Callable
into a function that ignores the given parameter.
Every Exception
thrown by the Callable
will be wrapped in a CacheRuntimeException
so that
the returned Function
does not throw any checked Exceptions
.
K
- The type of the ignored key.V
- The type of the value returned by the Callable
and Function
.callable
- The Callable
to wrap.Function
executing the given Callable
without looking at the parameter.@Nonnull public static <K,V> Function<K,V> wrapSupplierAsFunction(@Nonnull Supplier<V> supplier)
Supplier
into a function that ignores the given parameter.K
- The type of the ignored key.V
- The type of the value returned by the Supplier
and Function
.supplier
- The Supplier
to wrap.Function
executing the given Supplier
without looking at the parameter.Copyright © 2021 SAP SE. All rights reserved.