Interface Invoker<ARG,RET>
- Type Parameters:
ARG
- Argument typeRET
- Return type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The complement to the
Callable
interface - accepts one argument and possibly throws something-
Method Summary
Modifier and TypeMethodDescriptionstatic <ARG> void
invokeAll
(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) Invokes all the instances ignoring the return value.static <ARG> AbstractMap.SimpleImmutableEntry
<Invoker<? super ARG, ?>, Throwable> invokeTillFirstFailure
(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) Invokes all instances until 1st failure (if any)wrapAll
(Collection<? extends Invoker<? super ARG, ?>> invokers) Wraps a bunch ofInvoker
-s that return no value into one that invokes them in the same order as they appear.wrapFirst
(Collection<? extends Invoker<? super ARG, ?>> invokers) Wraps a bunch ofInvoker
-s that return no value into one that invokes them in the same order as they appear.
-
Method Details
-
invoke
- Throws:
Throwable
-
wrapAll
Wraps a bunch ofInvoker
-s that return no value into one that invokes them in the same order as they appear. Note: all invokers are used and any thrown exceptions are accumulated and thrown as a single exception at the end of invoking all of them.- Type Parameters:
ARG
- The argument type- Parameters:
invokers
- The invokers to wrap - ignored ifnull
/empty- Returns:
- The wrapper
- See Also:
-
invokeAll
static <ARG> void invokeAll(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) throws ThrowableInvokes all the instances ignoring the return value. Any intermediate exceptions are accumulated and thrown at the end.- Type Parameters:
ARG
- Argument type- Parameters:
arg
- The argument to pass to theinvoke(Object)
methodinvokers
- The invokers to scan - ignored ifnull
/empty (also ignoresnull
members)- Throws:
Throwable
- If invocation failed
-
wrapFirst
Wraps a bunch ofInvoker
-s that return no value into one that invokes them in the same order as they appear. Note: stops when first invoker throws an exception (otherwise invokes all)- Type Parameters:
ARG
- The argument type- Parameters:
invokers
- The invokers to wrap - ignored ifnull
/empty- Returns:
- The wrapper
- See Also:
-
invokeTillFirstFailure
static <ARG> AbstractMap.SimpleImmutableEntry<Invoker<? super ARG,?>, invokeTillFirstFailureThrowable> (ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) Invokes all instances until 1st failure (if any)- Type Parameters:
ARG
- Argument type- Parameters:
arg
- The argument to pass to theinvoke(Object)
methodinvokers
- The invokers to scan - ignored ifnull
/empty (also ignoresnull
members)- Returns:
- A
AbstractMap.SimpleImmutableEntry
representing the first failed invocation -null
if all were successful (or none invoked).
-