default ExceptionPredicate<T, E> not() { return t -> !test(t); }
default ExceptionPredicate<T, E> andThen(ExceptionPredicate<? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.test(apply(t)); }
/** * Run the given task with this contextual object selected. * * @param predicate the task to run (must not be {@code null}) * @param param the parameter to pass to the task * @param <T> the first parameter type * @param <E> the exception type * @return the action return value * @throws E if an exception occurs in the task */ default <T, E extends Exception> boolean runExPredicate(ExceptionPredicate<T, E> predicate, T param) throws E { final ContextManager<C> contextManager = getInstanceContextManager(); final C old = contextManager.getAndSetCurrent(this); try { return predicate.test(param); } finally { contextManager.restoreCurrent(old); } }
default ExceptionPredicate<T, E> not() { return t -> !test(t); }
default ExceptionPredicate<T, E> not() { return t -> !test(t); }
default ExceptionPredicate<T, E> andThen(ExceptionPredicate<? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.test(apply(t)); }
default ExceptionPredicate<T, E> andThen(ExceptionPredicate<? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.test(apply(t)); }
/** * Run the given task with this contextual object selected. * * @param predicate the task to run (must not be {@code null}) * @param param the parameter to pass to the task * @param <T> the first parameter type * @param <E> the exception type * @return the action return value * @throws E if an exception occurs in the task */ default <T, E extends Exception> boolean runExPredicate(ExceptionPredicate<T, E> predicate, T param) throws E { final ContextManager<C> contextManager = getInstanceContextManager(); final C old = contextManager.getAndSetCurrent(this); try { return predicate.test(param); } finally { contextManager.restoreCurrent(old); } }