T
- some generic flagE
- The extension@FunctionalInterface public interface PredicateWithThrowable<T,E extends Throwable> extends Predicate<T>
Modifier and Type | Method and Description |
---|---|
static <T,E extends Throwable> |
aPredicateThatUnsafelyThrowsUnchecked(PredicateWithThrowable<T,E> predicatewiththrowable)
Utility method to unwrap lambdas of type Predicate and withUncheckedThrowable any Exception
|
static <T,E extends Throwable> |
asPredicateWithThrowable(Predicate<T> predicate)
Utility method to convert PredicateWithThrowable
|
static <T,E extends Throwable> |
castPredicateWithThrowable(PredicateWithThrowable<T,E> predicatewiththrowable)
Utility method to mark lambdas of type PredicateWithThrowable
|
default PredicateWithThrowable<T,E> |
onException(BiConsumer<Throwable,Object[]> consumer) |
default PredicateWithThrowable<T,E> |
onException(Consumer<Throwable> consumer) |
default boolean |
test(T v1)
Overridden method of PredicateWithThrowable that will call testWithThrowable, but catching any exceptions.
|
boolean |
testWithThrowable(T v1)
Functional method that will throw exceptions.
|
default Predicate<T> |
thatReturnsOnCatch(boolean defaultReturnValue) |
default Predicate<T> |
thatUnsafelyThrowsUnchecked() |
default PredicateWithThrowable<T,E> |
withLogging()
Will log WARNING level exceptions on logger if they occur within the interface
|
default PredicateWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger)
Will log WARNING level exceptions on logger if they occur within the interface
|
default PredicateWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger,
String message) |
static <T,E extends Throwable> PredicateWithThrowable<T,E> castPredicateWithThrowable(PredicateWithThrowable<T,E> predicatewiththrowable)
T
- Generic that corresponds to the same generic on PredicateE
- The type this interface is allowed to throwpredicatewiththrowable
- The interface instancestatic <T,E extends Throwable> Predicate<T> aPredicateThatUnsafelyThrowsUnchecked(PredicateWithThrowable<T,E> predicatewiththrowable) throws E extends Throwable
T
- Generic that corresponds to the same generic on PredicateE
- The type this interface is allowed to throwpredicatewiththrowable
- The interface instanceE
- the original Exception from predicatewiththrowableE extends Throwable
static <T,E extends Throwable> PredicateWithThrowable<T,E> asPredicateWithThrowable(Predicate<T> predicate)
T
- Generic that corresponds to the same generic on PredicateE
- The type this interface is allowed to throwpredicate
- The interface instancedefault boolean test(T v1)
boolean testWithThrowable(T v1) throws E extends Throwable
default Predicate<T> thatReturnsOnCatch(boolean defaultReturnValue)
defaultReturnValue
- A value to return if any throwable is caught.default Predicate<T> thatUnsafelyThrowsUnchecked() throws E extends Throwable
default PredicateWithThrowable<T,E> withLogging(org.slf4j.Logger logger, String message)
logger
- The logger to log exceptions onmessage
- A message to use for logging exceptionsdefault PredicateWithThrowable<T,E> withLogging(org.slf4j.Logger logger)
logger
- The logger instance to log exceptions ondefault PredicateWithThrowable<T,E> withLogging()
default PredicateWithThrowable<T,E> onException(Consumer<Throwable> consumer)
consumer
- An exception consumer.default PredicateWithThrowable<T,E> onException(BiConsumer<Throwable,Object[]> consumer)
consumer
- An exception consumer.Copyright © 2017. All rights reserved.