Class LambdaSafe
java.lang.Object
org.springframework.boot.util.LambdaSafe
Utility that can be used to invoke lambdas in a safe way. Primarily designed to help
 support generically typed callbacks where 
class cast
 exceptions need to be dealt with due to class erasure.- Since:
- 2.0.0
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classRepresents a single callback that can be invoked in a lambda safe way.static final classRepresents a collection of callbacks that can be invoked in a lambda safe way.static interfaceA filter that can be used to restrict when a callback is used.static final classThe result of a callback which may be a value,nullor absent entirely if the callback wasn't suitable.protected static classLambdaSafe.LambdaSafeCallback<C, A, SELF extends LambdaSafe.LambdaSafeCallback<C,A, SELF>> Abstract base class for lambda safe callbacks.
- 
Method SummaryModifier and TypeMethodDescriptionstatic <C,A> LambdaSafe.Callback <C, A> callback(Class<C> callbackType, C callbackInstance, A argument, Object @Nullable ... 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.
- 
Method Details- 
callbackpublic static <C,A> LambdaSafe.Callback<C,A> callback(Class<C> callbackType, C callbackInstance, A argument, Object @Nullable ... additionalArguments) Start a call to a single callback instance, dealing with common generic type concerns and exceptions.- Type Parameters:
- C- the callback type
- A- the primary argument type
- Parameters:
- callbackType- the callback type (a- functional interface)
- callbackInstance- the callback instance (may be a lambda)
- argument- the primary argument passed to the callback
- additionalArguments- any additional arguments passed to the callback
- Returns:
- a LambdaSafe.Callbackinstance that can be invoked.
 
- 
callbackspublic 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.- Type Parameters:
- C- the callback type
- A- the primary argument type
- Parameters:
- callbackType- the callback type (a- functional interface)
- callbackInstances- the callback instances (elements may be lambdas)
- argument- the primary argument passed to the callbacks
- additionalArguments- any additional arguments passed to the callbacks
- Returns:
- a LambdaSafe.Callbacksinstance that can be invoked.
 
 
-