Interface LongConsumerWithException<E extends Exception>
-
- Type Parameters:
E- the type of the potential exception of the operation
- All Superinterfaces:
ExceptionHandlerSupport<LongConsumer,LongConsumer,LongConsumerWithException<E>>,NoReturnExceptionHandlerSupport<LongConsumer,LongFunction<CompletionStage<Void>>,LongConsumerWithException<E>>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface LongConsumerWithException<E extends Exception> extends NoReturnExceptionHandlerSupport<LongConsumer,LongFunction<CompletionStage<Void>>,LongConsumerWithException<E>>
Represents an operation that accepts a singlelong-valued argument, may throw exception and returns no result. This is the primitive type specialization ofConsumerWithExceptionforlong. Unlike most other functional interfaces,LongConsumerWithExceptionis expected to operate via side-effects.General contract
void accept(long value) throws E- The functional method.- uncheck - Return a
LongConsumer - lift - Return a
LongConsumer - ignore - Return a
LongConsumer
- See Also:
LongConsumer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaccept(long value)Performs this operation on the given argument.default LongConsumerWithException<E>andThen(LongConsumerWithException<? extends E> after)Returns a composedLongConsumerWithExceptionthat performs, in sequence, this operation followed by theafteroperation.static <E extends Exception>
ConsumerWithException<Long,E>asConsumer(LongConsumerWithException<E> operation)Converts aLongConsumerWithExceptionto aConsumerWithException.static <E extends Exception>
LongConsumerWithException<E>failing(Supplier<E> exceptionBuilder)Returns an operation that always throw exception.default LongConsumerignore()Converts thisLongConsumerWithExceptionto a liftedLongConsumerignoring exception.static <E extends Exception>
LongConsumerignored(LongConsumerWithException<E> operation)Converts aLongConsumerWithExceptionto a liftedLongConsumerignoring exception.static <E extends Exception>
LongConsumerlifted(LongConsumerWithException<E> operation)Converts aLongConsumerWithExceptionto a liftedLongConsumerignoring exception.default LongFunction<CompletionStage<Void>>stage()Converts thisLongConsumerWithExceptionto a stagedLongFunctionthat return aCompletionStage.static <E extends Exception>
LongFunction<CompletionStage<Void>>staged(LongConsumerWithException<E> operation)Converts aLongConsumerWithExceptionto a stagedLongFunction.default LongConsumeruncheck()Converts thisLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeException.static <E extends Exception>
LongConsumerunchecked(LongConsumerWithException<E> operation)Converts aLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeException.static <E extends Exception>
LongConsumerunchecked(LongConsumerWithException<E> operation, Function<Exception,RuntimeException> exceptionMapper)Converts aLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeExceptionby using the provided mapping function.-
Methods inherited from interface ch.powerunit.extensions.exceptions.ExceptionHandlerSupport
documented, exceptionMapper
-
Methods inherited from interface ch.powerunit.extensions.exceptions.NoReturnExceptionHandlerSupport
lift, notThrowingHandler, throwingHandler
-
-
-
-
Method Detail
-
accept
void accept(long value) throws E extends Exception
Performs this operation on the given argument.- Parameters:
value- the input argument- Throws:
E- any exceptionE extends Exception- See Also:
LongConsumer.accept(long)
-
uncheck
default LongConsumer uncheck()
Converts thisLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeException.- Specified by:
uncheckin interfaceExceptionHandlerSupport<LongConsumer,LongConsumer,LongConsumerWithException<E extends Exception>>- Specified by:
uncheckin interfaceNoReturnExceptionHandlerSupport<LongConsumer,LongFunction<CompletionStage<Void>>,LongConsumerWithException<E extends Exception>>- Returns:
- the unchecked operation
- See Also:
unchecked(LongConsumerWithException),unchecked(LongConsumerWithException, Function)
-
ignore
default LongConsumer ignore()
Converts thisLongConsumerWithExceptionto a liftedLongConsumerignoring exception.- Specified by:
ignorein interfaceExceptionHandlerSupport<LongConsumer,LongConsumer,LongConsumerWithException<E extends Exception>>- Specified by:
ignorein interfaceNoReturnExceptionHandlerSupport<LongConsumer,LongFunction<CompletionStage<Void>>,LongConsumerWithException<E extends Exception>>- Returns:
- the operation that ignore error
- See Also:
ignored(LongConsumerWithException)
-
stage
default LongFunction<CompletionStage<Void>> stage()
Converts thisLongConsumerWithExceptionto a stagedLongFunctionthat return aCompletionStage.- Specified by:
stagein interfaceNoReturnExceptionHandlerSupport<LongConsumer,LongFunction<CompletionStage<Void>>,LongConsumerWithException<E extends Exception>>- Returns:
- the staged operation.
- Since:
- 1.1.0
-
andThen
default LongConsumerWithException<E> andThen(LongConsumerWithException<? extends E> after)
Returns a composedLongConsumerWithExceptionthat performs, in sequence, this operation followed by theafteroperation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, theafteroperation will not be performed.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
LongConsumerthat performs in sequence this operation followed by theafteroperation - Throws:
NullPointerException- ifafteris null- See Also:
LongConsumer.andThen(LongConsumer)
-
failing
static <E extends Exception> LongConsumerWithException<E> failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.- Type Parameters:
E- the type of the exception- Parameters:
exceptionBuilder- the supplier to create the exception- Returns:
- an operation that always throw exception
-
unchecked
static <E extends Exception> LongConsumer unchecked(LongConsumerWithException<E> operation)
Converts aLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeException.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- to be unchecked- Returns:
- the unchecked operation
- Throws:
NullPointerException- if operation is null- See Also:
uncheck(),unchecked(LongConsumerWithException, Function)
-
unchecked
static <E extends Exception> LongConsumer unchecked(LongConsumerWithException<E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aLongConsumerWithExceptionto aLongConsumerthat convert exception toRuntimeExceptionby using the provided mapping function.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- the be uncheckedexceptionMapper- a function to convert the exception to the runtime exception.- Returns:
- the unchecked operation
- Throws:
NullPointerException- if operation or exceptionMapper is null- See Also:
uncheck(),unchecked(LongConsumerWithException)
-
lifted
static <E extends Exception> LongConsumer lifted(LongConsumerWithException<E> operation)
Converts aLongConsumerWithExceptionto a liftedLongConsumerignoring exception.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- to be lifted- Returns:
- the lifted operation
- Throws:
NullPointerException- if operation is null- See Also:
NoReturnExceptionHandlerSupport.lift()
-
ignored
static <E extends Exception> LongConsumer ignored(LongConsumerWithException<E> operation)
Converts aLongConsumerWithExceptionto a liftedLongConsumerignoring exception.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- to be lifted- Returns:
- the lifted operation
- Throws:
NullPointerException- if operation is null- See Also:
ignore()
-
staged
static <E extends Exception> LongFunction<CompletionStage<Void>> staged(LongConsumerWithException<E> operation)
Converts aLongConsumerWithExceptionto a stagedLongFunction.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- to be staged- Returns:
- the staged operation
- Throws:
NullPointerException- if operation is null- Since:
- 1.1.0
-
asConsumer
static <E extends Exception> ConsumerWithException<Long,E> asConsumer(LongConsumerWithException<E> operation)
Converts aLongConsumerWithExceptionto aConsumerWithException.- Type Parameters:
E- the type of the potential exception- Parameters:
operation- to be converted- Returns:
- the consumer
- Throws:
NullPointerException- if operation is null
-
-