Interface ObjLongConsumerWithException<T,E extends Exception>
-
- Type Parameters:
T
- the type of the object argument to the operationE
- the type of the potential exception of the operation
- All Superinterfaces:
ExceptionHandlerSupport<ObjLongConsumer<T>,ObjLongConsumer<T>,ObjLongConsumerWithException<T,E>>
,NoReturnExceptionHandlerSupport<ObjLongConsumer<T>,BiFunction<T,Long,CompletionStage<Void>>,ObjLongConsumerWithException<T,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 ObjLongConsumerWithException<T,E extends Exception> extends NoReturnExceptionHandlerSupport<ObjLongConsumer<T>,BiFunction<T,Long,CompletionStage<Void>>,ObjLongConsumerWithException<T,E>>
Represents an operation that accepts an object-valued and along
-valued argument, and returns no result. This is the(reference, long)
specialization ofBiConsumerWithException
. Unlike most other functional interfaces,ObjLongConsumerWithException
is expected to operate via side-effects.General contract
void accept(T t, long value) throws E
- The functional method.- uncheck - Return a
ObjLongConsumer<T>
- lift - Return a
ObjLongConsumer<T>
- ignore - Return a
ObjLongConsumer<T>
- See Also:
ObjLongConsumer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
accept(T t, long value)
Performs this operation on the given arguments.static <T,E extends Exception>
BiConsumerWithException<T,Long,E>asBiConsumer(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to aBiConsumerWithException
returningnull
.static <T,E extends Exception>
ObjLongConsumerWithException<T,E>failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.default ObjLongConsumer<T>
ignore()
Converts thisObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.static <T,E extends Exception>
ObjLongConsumer<T>ignored(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.static <T,E extends Exception>
ObjLongConsumer<T>lifted(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.default BiFunction<T,Long,CompletionStage<Void>>
stage()
Converts thisObjLongConsumerWithException
to a stagedBiFunction
that return aCompletionStage
.static <T,E extends Exception>
BiFunction<T,Long,CompletionStage<Void>>staged(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a stagedBiFunction
.default ObjLongConsumer<T>
uncheck()
Converts thisObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
.static <T,E extends Exception>
ObjLongConsumer<T>unchecked(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
.static <T,E extends Exception>
ObjLongConsumer<T>unchecked(ObjLongConsumerWithException<T,E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
by 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(T t, long value) throws E extends Exception
Performs this operation on the given arguments.- Parameters:
t
- the first input argumentvalue
- the second input argument- Throws:
E
- any exceptionE extends Exception
- See Also:
ObjLongConsumer.accept(Object,long)
-
uncheck
default ObjLongConsumer<T> uncheck()
Converts thisObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
.- Specified by:
uncheck
in interfaceExceptionHandlerSupport<ObjLongConsumer<T>,ObjLongConsumer<T>,ObjLongConsumerWithException<T,E extends Exception>>
- Specified by:
uncheck
in interfaceNoReturnExceptionHandlerSupport<ObjLongConsumer<T>,BiFunction<T,Long,CompletionStage<Void>>,ObjLongConsumerWithException<T,E extends Exception>>
- Returns:
- the unchecked operation
- See Also:
unchecked(ObjLongConsumerWithException)
,unchecked(ObjLongConsumerWithException, Function)
-
ignore
default ObjLongConsumer<T> ignore()
Converts thisObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.- Specified by:
ignore
in interfaceExceptionHandlerSupport<ObjLongConsumer<T>,ObjLongConsumer<T>,ObjLongConsumerWithException<T,E extends Exception>>
- Specified by:
ignore
in interfaceNoReturnExceptionHandlerSupport<ObjLongConsumer<T>,BiFunction<T,Long,CompletionStage<Void>>,ObjLongConsumerWithException<T,E extends Exception>>
- Returns:
- the operation that ignore error
- See Also:
ignored(ObjLongConsumerWithException)
-
stage
default BiFunction<T,Long,CompletionStage<Void>> stage()
Converts thisObjLongConsumerWithException
to a stagedBiFunction
that return aCompletionStage
.- Specified by:
stage
in interfaceNoReturnExceptionHandlerSupport<ObjLongConsumer<T>,BiFunction<T,Long,CompletionStage<Void>>,ObjLongConsumerWithException<T,E extends Exception>>
- Returns:
- the staged operation.
- Since:
- 1.1.0
-
failing
static <T,E extends Exception> ObjLongConsumerWithException<T,E> failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.- Type Parameters:
T
- the type of the object argument to the operationE
- the type of the exception- Parameters:
exceptionBuilder
- the supplier to create the exception- Returns:
- an operation that always throw exception
-
unchecked
static <T,E extends Exception> ObjLongConsumer<T> unchecked(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
.- Type Parameters:
T
- the type of the object argument to the operationE
- 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(ObjLongConsumerWithException, Function)
-
unchecked
static <T,E extends Exception> ObjLongConsumer<T> unchecked(ObjLongConsumerWithException<T,E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aObjLongConsumerWithException
to aObjLongConsumer
that wraps exception toRuntimeException
by using the provided mapping function.- Type Parameters:
T
- the type of the object argument to the operationE
- 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(ObjLongConsumerWithException)
-
lifted
static <T,E extends Exception> ObjLongConsumer<T> lifted(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.- Type Parameters:
T
- the type of the object argument to the operationE
- 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 <T,E extends Exception> ObjLongConsumer<T> ignored(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a liftedObjLongConsumer
ignoring exception.- Type Parameters:
T
- the type of the object argument to the operationE
- 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 <T,E extends Exception> BiFunction<T,Long,CompletionStage<Void>> staged(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to a stagedBiFunction
.- Type Parameters:
T
- the type of the object argument to the operationE
- 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
-
asBiConsumer
static <T,E extends Exception> BiConsumerWithException<T,Long,E> asBiConsumer(ObjLongConsumerWithException<T,E> operation)
Converts aObjLongConsumerWithException
to aBiConsumerWithException
returningnull
.- Type Parameters:
T
- the type of the object argument to the operationE
- the type of the potential exception- Parameters:
operation
- to be lifted- Returns:
- the bi consumer
- Throws:
NullPointerException
- if operation is null
-
-