T
- some generic flagE
- The extension@FunctionalInterface public interface ConsumerWithThrowable<T,E extends Throwable> extends Consumer<T>
Modifier and Type | Method and Description |
---|---|
default void |
accept(T v1)
Overridden method of ConsumerWithThrowable that will call acceptWithThrowable, but catching any exceptions.
|
void |
acceptWithThrowable(T v1)
Functional method that will throw exceptions.
|
static <T,E extends Throwable> |
aConsumerThatUnsafelyThrowsUnchecked(ConsumerWithThrowable<T,E> consumerwiththrowable)
Utility method to unwrap lambdas of type Consumer and withUncheckedThrowable any Exception
|
static <T,E extends Throwable> |
asConsumerWithThrowable(Consumer<T> consumer)
Utility method to convert ConsumerWithThrowable
|
static <T,E extends Throwable> |
castConsumerWithThrowable(ConsumerWithThrowable<T,E> consumerwiththrowable)
Utility method to mark lambdas of type ConsumerWithThrowable
|
default ConsumerWithThrowable<T,E> |
onException(BiConsumer<Throwable,Object[]> consumer) |
default ConsumerWithThrowable<T,E> |
onException(Consumer<Throwable> consumer) |
default Consumer<T> |
thatThrowsNothing() |
default Consumer<T> |
thatUnsafelyThrowsUnchecked() |
default ConsumerWithThrowable<T,E> |
withLogging()
Will log WARNING level exceptions on logger if they occur within the interface
|
default ConsumerWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger)
Will log WARNING level exceptions on logger if they occur within the interface
|
default ConsumerWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger,
String message) |
static <T,E extends Throwable> ConsumerWithThrowable<T,E> castConsumerWithThrowable(ConsumerWithThrowable<T,E> consumerwiththrowable)
T
- Generic that corresponds to the same generic on ConsumerE
- The type this interface is allowed to throwconsumerwiththrowable
- The interface instancestatic <T,E extends Throwable> Consumer<T> aConsumerThatUnsafelyThrowsUnchecked(ConsumerWithThrowable<T,E> consumerwiththrowable) throws E extends Throwable
T
- Generic that corresponds to the same generic on ConsumerE
- The type this interface is allowed to throwconsumerwiththrowable
- The interface instanceE
- the original Exception from consumerwiththrowableE extends Throwable
static <T,E extends Throwable> ConsumerWithThrowable<T,E> asConsumerWithThrowable(Consumer<T> consumer)
T
- Generic that corresponds to the same generic on ConsumerE
- The type this interface is allowed to throwconsumer
- The interface instancedefault void accept(T v1)
void acceptWithThrowable(T v1) throws E extends Throwable
default Consumer<T> thatThrowsNothing()
default Consumer<T> thatUnsafelyThrowsUnchecked() throws E extends Throwable
default ConsumerWithThrowable<T,E> withLogging(org.slf4j.Logger logger, String message)
logger
- The logger to log exceptions onmessage
- A message to use for logging exceptionsdefault ConsumerWithThrowable<T,E> withLogging(org.slf4j.Logger logger)
logger
- The logger instance to log exceptions ondefault ConsumerWithThrowable<T,E> withLogging()
default ConsumerWithThrowable<T,E> onException(Consumer<Throwable> consumer)
consumer
- An exception consumer.default ConsumerWithThrowable<T,E> onException(BiConsumer<Throwable,Object[]> consumer)
consumer
- An exception consumer.Copyright © 2017. All rights reserved.