public final class LambdaSafe extends Object
class cast
exceptions need to be dealt with due to class erasure.| Modifier and Type | Class and Description |
|---|---|
static class |
LambdaSafe.Callback<C,A>
Represents a single callback that can be invoked in a lambda safe way.
|
static class |
LambdaSafe.Callbacks<C,A>
Represents a collection of callbacks that can be invoked in a lambda safe way.
|
static class |
LambdaSafe.InvocationResult<R>
The result of a callback which may be a value,
null or absent entirely if
the callback wasn't suitable. |
protected static class |
LambdaSafe.LambdaSafeCallback<C,A,SELF extends LambdaSafe.LambdaSafeCallback<C,A,SELF>>
Abstract base class for lambda safe callbacks.
|
| Modifier and Type | Method and Description |
|---|---|
static <C,A> LambdaSafe.Callback<C,A> |
callback(Class<C> callbackType,
C callbackInstance,
A argument,
Object... additionalArguments)
Start a call to a single callback instance, dealing with common generic type
concerns and exceptions.
|
static <C,A> LambdaSafe.Callbacks<C,A> |
callbacks(Class<C> callbackType,
Collection<? extends C> callbackInstances,
A argument,
Object... additionalArguments)
Start a call to callback instances, dealing with common generic type concerns and
exceptions.
|
public static <C,A> LambdaSafe.Callback<C,A> callback(Class<C> callbackType, C callbackInstance, A argument, Object... additionalArguments)
C - the callback typeA - the primary argument typecallbackType - the callback type (a functional
interface)callbackInstance - the callback instance (may be a lambda)argument - the primary argument passed to the callbackadditionalArguments - any additional arguments passed to the callbackLambdaSafe.Callback instance that can be invoked.public static <C,A> LambdaSafe.Callbacks<C,A> callbacks(Class<C> callbackType, Collection<? extends C> callbackInstances, A argument, Object... additionalArguments)
C - the callback typeA - the primary argument typecallbackType - the callback type (a functional
interface)callbackInstances - the callback instances (elements may be lambdas)argument - the primary argument passed to the callbacksadditionalArguments - any additional arguments passed to the callbacksLambdaSafe.Callbacks instance that can be invoked.