Top Description Methods
org.apache.sshd.common.util.io.functors

public Interface Invoker<ARG, RET>

Annotations
@FunctionalInterface
Type Parameters
<ARG>
Argument type
<RET>
Return type
Imports
java.util.AbstractMap.SimpleImmutableEntry, .Collection, .Map, org.apache.sshd.common.util.ExceptionUtils, .GenericUtils

The complement to the Callable interface - accepts one argument and possibly throws something
Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public RET
invoke(ARG arg)

public static <
Argument type
ARG
>
void
invokeAll(ARG
The argument to pass to the invoke(Object) method
arg
,
Collection<? extends Invoker<? super ARG, ?>>
The invokers to scan - ignored if null/empty (also ignores null members)
invokers
)

Invokes all the instances ignoring the return value.

public static <
Argument type
ARG
>
AbstractMap.SimpleImmutableEntry<Invoker<? super ARG, ?>, Throwable>

Returns:

A SimpleImmutableEntry representing the first failed invocation - null if all were successful (or none invoked).
invokeTillFirstFailure
(ARG
The argument to pass to the invoke(Object) method
arg
,
Collection<? extends Invoker<? super ARG, ?>>
The invokers to scan - ignored if null/empty (also ignores null members)
invokers
)

Invokes all instances until 1st failure (if any)

public static <
The argument type
ARG
>
Invoker<ARG, Void>

Returns:

The wrapper
wrapAll
(Collection<? extends Invoker<? super ARG, ?>>
The invokers to wrap - ignored if null/empty
invokers
)

Wraps a bunch of Invoker-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.

public static <
The argument type
ARG
>
Invoker<ARG, Void>

Returns:

The wrapper
wrapFirst
(Collection<? extends Invoker<? super ARG, ?>>
The invokers to wrap - ignored if null/empty
invokers
)

Wraps a bunch of Invoker-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)

Method Detail

invokeback to summary
public RET invoke(ARG arg) throws Throwable
invokeAllback to summary
public static <ARG> void invokeAll(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) throws Throwable

Invokes all the instances ignoring the return value. Any intermediate exceptions are accumulated and thrown at the end.

Parameters
<ARG>
Argument type
arg:ARG

The argument to pass to the invoke(Object) method

invokers:Collection<? extends Invoker<? super ARG, ?>>

The invokers to scan - ignored if null/empty (also ignores null members)

Exceptions
Throwable:
If invocation failed
invokeTillFirstFailureback to summary
public 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)

Parameters
<ARG>
Argument type
arg:ARG

The argument to pass to the invoke(Object) method

invokers:Collection<? extends Invoker<? super ARG, ?>>

The invokers to scan - ignored if null/empty (also ignores null members)

Returns:AbstractMap.SimpleImmutableEntry<Invoker<? super ARG, ?>, Throwable>

A SimpleImmutableEntry representing the first failed invocation - null if all were successful (or none invoked).

wrapAllback to summary
public static <ARG> Invoker<ARG, Void> wrapAll(Collection<? extends Invoker<? super ARG, ?>> invokers)

Wraps a bunch of Invoker-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.

Parameters
<ARG>
The argument type
invokers:Collection<? extends Invoker<? super ARG, ?>>

The invokers to wrap - ignored if null/empty

Returns:Invoker<ARG, Void>

The wrapper

See Also
invokeAll
wrapFirstback to summary
public static <ARG> Invoker<ARG, Void> wrapFirst(Collection<? extends Invoker<? super ARG, ?>> invokers)

Wraps a bunch of Invoker-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)

Parameters
<ARG>
The argument type
invokers:Collection<? extends Invoker<? super ARG, ?>>

The invokers to wrap - ignored if null/empty

Returns:Invoker<ARG, Void>

The wrapper

See Also
invokeTillFirstFailure