protected final <R> InvocationResult<R> invoke(C callbackInstance, Supplier<R> supplier) { if (this.filter.match(this.callbackType, callbackInstance, this.argument, this.additionalArguments)) { try { return InvocationResult.of(supplier.get()); } catch (ClassCastException ex) { if (!isLambdaGenericProblem(ex)) { throw ex; } logNonMatchingType(callbackInstance, ex); } } return InvocationResult.noResult(); }
@SuppressWarnings("unchecked") private boolean isFilterMatch(EndpointFilter<E> filter, E endpoint) { return LambdaSafe.callback(EndpointFilter.class, filter, endpoint) .withLogger(EndpointDiscoverer.class).invokeAnd((f) -> f.match(endpoint)) .get(); }
/** * Create a new {@link InvocationResult} instance with the specified value. * @param value the value (may be {@code null}) * @param <R> the result type * @return an {@link InvocationResult} */ public static <R> InvocationResult<R> of(R value) { return new InvocationResult<>(value); }