Home / Class/ Callback Class — spring-boot Architecture

Callback Class — spring-boot Architecture

Architecture documentation for the Callback 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 241–275

	public static final class Callback<C, A> extends LambdaSafeCallback<C, A, Callback<C, A>> {

		private final C callbackInstance;

		private Callback(Class<C> callbackType, C callbackInstance, A argument,
				@Nullable Object @Nullable [] additionalArguments) {
			super(callbackType, argument, additionalArguments);
			this.callbackInstance = callbackInstance;
		}

		/**
		 * Invoke the callback instance where the callback method returns void.
		 * @param invoker the invoker used to invoke the callback
		 */
		public void invoke(Consumer<C> invoker) {
			Supplier<@Nullable Void> supplier = () -> {
				invoker.accept(this.callbackInstance);
				return null;
			};
			invoke(this.callbackInstance, supplier);
		}

		/**
		 * Invoke the callback instance where the callback method returns a result.
		 * @param invoker the invoker used to invoke the callback
		 * @param <R> the result type
		 * @return the result of the invocation (may be {@link InvocationResult#noResult}
		 * if the callback was not invoked)
		 */
		public <R> InvocationResult<R> invokeAnd(Function<C, @Nullable R> invoker) {
			Supplier<@Nullable R> supplier = () -> invoker.apply(this.callbackInstance);
			return invoke(this.callbackInstance, supplier);
		}

	}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free