R
- some generic flagE
- The extension@FunctionalInterface public interface LongFunctionWithThrowable<R,E extends Throwable> extends LongFunction<R>
Modifier and Type | Method and Description |
---|---|
static <R,E extends Throwable> |
aLongFunctionThatUnsafelyThrowsUnchecked(LongFunctionWithThrowable<R,E> longfunctionwiththrowable)
Utility method to unwrap lambdas of type LongFunction and withUncheckedThrowable any Exception
|
default R |
apply(long v1)
Overridden method of LongFunctionWithThrowable that will call applyWithThrowable, but catching any exceptions.
|
R |
applyWithThrowable(long v1)
Functional method that will throw exceptions.
|
static <R,E extends Throwable> |
asLongFunctionWithThrowable(LongFunction<R> longfunction)
Utility method to convert LongFunctionWithThrowable
|
static <R,E extends Throwable> |
castLongFunctionWithThrowable(LongFunctionWithThrowable<R,E> longfunctionwiththrowable)
Utility method to mark lambdas of type LongFunctionWithThrowable
|
default LongFunctionWithThrowable<R,E> |
onException(BiConsumer<Throwable,Object[]> consumer) |
default LongFunctionWithThrowable<R,E> |
onException(Consumer<Throwable> consumer) |
default LongFunction<R> |
thatReturnsOnCatch(R defaultReturnValue) |
default LongFunction<Optional<R>> |
thatReturnsOptional() |
default LongFunction<R> |
thatUnsafelyThrowsUnchecked() |
default LongFunctionWithThrowable<R,E> |
withLogging()
Will log WARNING level exceptions on logger if they occur within the interface
|
default LongFunctionWithThrowable<R,E> |
withLogging(org.slf4j.Logger logger)
Will log WARNING level exceptions on logger if they occur within the interface
|
default LongFunctionWithThrowable<R,E> |
withLogging(org.slf4j.Logger logger,
String message) |
static <R,E extends Throwable> LongFunctionWithThrowable<R,E> castLongFunctionWithThrowable(LongFunctionWithThrowable<R,E> longfunctionwiththrowable)
R
- Generic that corresponds to the same generic on LongFunctionE
- The type this interface is allowed to throwlongfunctionwiththrowable
- The interface instancestatic <R,E extends Throwable> LongFunction<R> aLongFunctionThatUnsafelyThrowsUnchecked(LongFunctionWithThrowable<R,E> longfunctionwiththrowable) throws E extends Throwable
R
- Generic that corresponds to the same generic on LongFunctionE
- The type this interface is allowed to throwlongfunctionwiththrowable
- The interface instanceE
- the original Exception from longfunctionwiththrowableE extends Throwable
static <R,E extends Throwable> LongFunctionWithThrowable<R,E> asLongFunctionWithThrowable(LongFunction<R> longfunction)
R
- Generic that corresponds to the same generic on LongFunctionE
- The type this interface is allowed to throwlongfunction
- The interface instancedefault R apply(long v1)
apply
in interface LongFunction<R>
v1
- parameter to overridden methodR applyWithThrowable(long v1) throws E extends Throwable
default LongFunction<Optional<R>> thatReturnsOptional()
default LongFunction<R> thatReturnsOnCatch(R defaultReturnValue)
defaultReturnValue
- A value to return if any throwable is caught.default LongFunction<R> thatUnsafelyThrowsUnchecked() throws E extends Throwable
default LongFunctionWithThrowable<R,E> withLogging(org.slf4j.Logger logger, String message)
logger
- The logger to log exceptions onmessage
- A message to use for logging exceptionsdefault LongFunctionWithThrowable<R,E> withLogging(org.slf4j.Logger logger)
logger
- The logger instance to log exceptions ondefault LongFunctionWithThrowable<R,E> withLogging()
default LongFunctionWithThrowable<R,E> onException(Consumer<Throwable> consumer)
consumer
- An exception consumer.default LongFunctionWithThrowable<R,E> onException(BiConsumer<Throwable,Object[]> consumer)
consumer
- An exception consumer.Copyright © 2017. All rights reserved.