T - the type of the input to the predicateE - the type of the potential exception of the functionExceptionHandlerSupport<T,E>, PrimitiveReturnExceptionHandlerSupport<Predicate<T>>@FunctionalInterface public interface PredicateWithException<T,E extends Exception> extends PrimitiveReturnExceptionHandlerSupport<Predicate<T>>
boolean test(T t) throws E - The
functional method.Predicate<T>Predicate<T>Predicate<T>Predicate| Modifier and Type | Method | Description |
|---|---|---|
default PredicateWithException<T,E> |
and(PredicateWithException<? super T,? extends E> other) |
Returns a composed predicate that represents a short-circuiting logical AND
of this predicate and another.
|
static <T,E extends Exception> |
failing(Supplier<E> exceptionBuilder) |
Returns a predicate that always throw exception.
|
static <T,E extends Exception> |
ignored(PredicateWithException<T,E> predicate) |
Converts a
PredicateWithException to a lifted Predicate
returning false in case of exception. |
static <T,E extends Exception> |
lifted(PredicateWithException<T,E> predicate) |
Converts a
PredicateWithException to a lifted Predicate
returning false in case of exception. |
default PredicateWithException<T,E> |
negate() |
Returns a predicate that represents the logical negation of this predicate.
|
static <T,E extends Exception> |
negate(PredicateWithException<T,E> predicate) |
Negate a
PredicateWithException. |
default PredicateWithException<T,E> |
or(PredicateWithException<? super T,? extends E> other) |
Returns a composed predicate that represents a short-circuiting logical OR of
this predicate and another.
|
boolean |
test(T t) |
Evaluates this predicate on the given argument.
|
static <T,E extends Exception> |
unchecked(PredicateWithException<T,E> predicate) |
Converts a
PredicateWithException to a Predicate that wraps
exception to RuntimeException. |
static <T,E extends Exception> |
unchecked(PredicateWithException<T,E> predicate,
Function<Exception,RuntimeException> exceptionMapper) |
Converts a
PredicateWithException to a Predicate that wraps
exception to RuntimeException by using the provided mapping function. |
default Predicate<T> |
uncheckOrIgnore(boolean uncheck) |
Used internally to implements the ignore or uncheck operation.
|
exceptionMapper, exceptionMapperForhandleException, ignore, lift, uncheckboolean test(T t) throws E extends Exception
t - the input argumenttrue if the input argument matches the predicate, otherwise
falseE - any exceptionE extends ExceptionPredicate.test(Object)default Predicate<T> uncheckOrIgnore(boolean uncheck)
PrimitiveReturnExceptionHandlerSupportuncheckOrIgnore in interface PrimitiveReturnExceptionHandlerSupport<T>uncheck - create unchecked version of the function when true, else ignored
version.default PredicateWithException<T,E> and(PredicateWithException<? super T,? extends E> other)
false, then the other predicate is not
evaluated.
Any exceptions thrown during evaluation of either predicate are relayed to
the caller; if evaluation of this predicate throws an exception, the
other predicate will not be evaluated.
other - a predicate that will be logically-ANDed with this predicateother predicateNullPointerException - if other is nullor(PredicateWithException),
negate()default PredicateWithException<T,E> negate()
and(PredicateWithException),
or(PredicateWithException)static <T,E extends Exception> PredicateWithException<T,E> negate(PredicateWithException<T,E> predicate)
PredicateWithException.T - the type of the input to the predicateE - the type of the potential exceptionpredicate - to be negateNullPointerException - if predicate is nullnegate()default PredicateWithException<T,E> or(PredicateWithException<? super T,? extends E> other)
true, then the other predicate is not evaluated.
Any exceptions thrown during evaluation of either predicate are relayed to
the caller; if evaluation of this predicate throws an exception, the
other predicate will not be evaluated.
other - a predicate that will be logically-ORed with this predicateother predicateNullPointerException - if other is nulland(PredicateWithException),
negate()static <T,E extends Exception> PredicateWithException<T,E> failing(Supplier<E> exceptionBuilder)
T - the type of the input to the predicateE - the type of the exceptionexceptionBuilder - the supplier to create the exceptionstatic <T,E extends Exception> Predicate<T> unchecked(PredicateWithException<T,E> predicate)
PredicateWithException to a Predicate that wraps
exception to RuntimeException.T - the type of the input to the predicateE - the type of the potential exceptionpredicate - to be uncheckedNullPointerException - if predicate is nullPrimitiveReturnExceptionHandlerSupport.uncheck(),
unchecked(PredicateWithException, Function)static <T,E extends Exception> Predicate<T> unchecked(PredicateWithException<T,E> predicate, Function<Exception,RuntimeException> exceptionMapper)
PredicateWithException to a Predicate that wraps
exception to RuntimeException by using the provided mapping function.T - the type of the input object to the functionE - the type of the potential exceptionpredicate - the be uncheckedexceptionMapper - a function to convert the exception to the runtime exception.NullPointerException - if predicate or exceptionMapper is nullPrimitiveReturnExceptionHandlerSupport.uncheck(),
unchecked(PredicateWithException)static <T,E extends Exception> Predicate<T> lifted(PredicateWithException<T,E> predicate)
PredicateWithException to a lifted Predicate
returning false in case of exception.T - the type of the input to the predicateE - the type of the potential exceptionpredicate - to be liftedNullPointerException - if predicate is nullPrimitiveReturnExceptionHandlerSupport.lift()static <T,E extends Exception> Predicate<T> ignored(PredicateWithException<T,E> predicate)
PredicateWithException to a lifted Predicate
returning false in case of exception.T - the type of the input to the predicateE - the type of the potential exceptionpredicate - to be liftedNullPointerException - if predicate is nullPrimitiveReturnExceptionHandlerSupport.ignore()Copyright © 2019. All rights reserved.