Callbacks Class — spring-boot Architecture
Architecture documentation for the Callbacks class in LambdaSafe.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java lines 283–325
public static final class Callbacks<C, A> extends LambdaSafeCallback<C, A, Callbacks<C, A>> {
private final Collection<? extends C> callbackInstances;
private Callbacks(Class<C> callbackType, Collection<? extends C> callbackInstances, A argument,
Object[] additionalArguments) {
super(callbackType, argument, additionalArguments);
this.callbackInstances = callbackInstances;
}
/**
* Invoke the callback instances where the callback method returns void.
* @param invoker the invoker used to invoke the callback
*/
public void invoke(Consumer<C> invoker) {
this.callbackInstances.forEach((callbackInstance) -> {
Supplier<@Nullable Void> supplier = () -> {
invoker.accept(callbackInstance);
return null;
};
invoke(callbackInstance, supplier);
});
}
/**
* Invoke the callback instances where the callback method returns a result.
* @param invoker the invoker used to invoke the callback
* @param <R> the result type
* @return the results of the invocation (may be an empty stream if no callbacks
* could be called)
*/
public <R> Stream<R> invokeAnd(Function<C, @Nullable R> invoker) {
Function<C, InvocationResult<R>> mapper = (callbackInstance) -> {
Supplier<@Nullable R> supplier = () -> invoker.apply(callbackInstance);
return invoke(callbackInstance, supplier);
};
return this.callbackInstances.stream()
.map(mapper)
.filter(InvocationResult::hasResult)
.map(InvocationResult::get);
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free