default ExceptionBiPredicate<T, U, E> not() { return (t, u) -> !test(t, u); } }
public <T, U, E extends Exception> boolean runAsExBiPredicate(ExceptionBiPredicate<T, U, E> action, T param1, U param2) throws E { final Supplier<SecurityIdentity> old = securityDomain.getAndSetCurrentSecurityIdentity(this); try { return action.test(param1, param2); } finally { securityDomain.setCurrentSecurityIdentity(old); } } }
default ExceptionPredicate<T, E> andThen(ExceptionBiPredicate<? super T, ? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.test(t, apply(t)); }
/** * Run the given task with this contextual object selected. * * @param predicate the task to run (must not be {@code null}) * @param param1 the first parameter to pass to the task * @param param2 the second parameter to pass to the task * @param <T> the first parameter type * @param <U> the second parameter type * @param <E> the exception type * @return the action return value * @throws E if an exception occurs in the task */ default <T, U, E extends Exception> boolean runExBiPredicate(ExceptionBiPredicate<T, U, E> predicate, T param1, U param2) throws E { final ContextManager<C> contextManager = getInstanceContextManager(); final C old = contextManager.getAndSetCurrent(this); try { return predicate.test(param1, param2); } finally { contextManager.restoreCurrent(old); } }
/** * Run an action under this identity. * * @param parameter1 the first parameter to pass to the action * @param parameter2 the second parameter to pass to the action * @param action the action to run * @param <T> the action first parameter type * @param <U> the action second parameter type * @param <E> the action exception type * @return the action result (may be {@code null}) * @throws E if the action throws this exception */ public <T, U, E extends Exception> boolean runAsExBiPredicate(ExceptionBiPredicate<T, U, E> action, T parameter1, U parameter2) throws E { if (action == null) return false; final Supplier<SecurityIdentity>[] oldWithIdentities = establishIdentities(); final Supplier<SecurityIdentity> oldIdentity = securityDomain.getAndSetCurrentSecurityIdentity(this); try { return action.test(parameter1, parameter2); } finally { securityDomain.setCurrentSecurityIdentity(oldIdentity); restoreIdentities(oldWithIdentities); } }
default ExceptionBiPredicate<T, U, E> not() { return (t, u) -> !test(t, u); } }
default ExceptionBiPredicate<T, U, E> not() { return (t, u) -> !test(t, u); } }
public <T, U, E extends Exception> boolean runAsExBiPredicate(ExceptionBiPredicate<T, U, E> action, T param1, U param2) throws E { final Supplier<SecurityIdentity> old = securityDomain.getAndSetCurrentSecurityIdentity(this); try { return action.test(param1, param2); } finally { securityDomain.setCurrentSecurityIdentity(old); } } }
public <T, U, E extends Exception> boolean runAsExBiPredicate(ExceptionBiPredicate<T, U, E> action, T param1, U param2) throws E { final Supplier<SecurityIdentity> old = securityDomain.getAndSetCurrentSecurityIdentity(this); try { return action.test(param1, param2); } finally { securityDomain.setCurrentSecurityIdentity(old); } } }
public <T, U, E extends Exception> boolean runAsExBiPredicate(ExceptionBiPredicate<T, U, E> action, T param1, U param2) throws E { final Supplier<SecurityIdentity> old = securityDomain.getAndSetCurrentSecurityIdentity(this); try { return action.test(param1, param2); } finally { securityDomain.setCurrentSecurityIdentity(old); } } }
default ExceptionPredicate<T, E> andThen(ExceptionBiPredicate<? super T, ? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.test(t, apply(t)); }