Interface ObjIntConsumerWithException<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<ObjIntConsumer<T>,ObjIntConsumer<T>,ObjIntConsumerWithException<T,E>>
,NoReturnExceptionHandlerSupport<ObjIntConsumer<T>,BiFunction<T,Integer,CompletionStage<Void>>,ObjIntConsumerWithException<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 ObjIntConsumerWithException<T,E extends Exception> extends NoReturnExceptionHandlerSupport<ObjIntConsumer<T>,BiFunction<T,Integer,CompletionStage<Void>>,ObjIntConsumerWithException<T,E>>
Represents an operation that accepts an object-valued and aint
-valued argument, and returns no result. This is the(reference, int)
specialization ofBiConsumerWithException
. Unlike most other functional interfaces,ObjIntConsumer
is expected to operate via side-effects.General contract
void accept(T t, int value) throws E
- The functional method.- uncheck - Return a
ObjIntConsumer<T>
- lift - Return a
ObjIntConsumer<T>
- ignore - Return a
ObjIntConsumer<T>
- See Also:
ObjIntConsumer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
accept(T t, int value)
Performs this operation on the given arguments.static <T,E extends Exception>
BiConsumerWithException<T,Integer,E>asBiConsumer(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to aBiConsumerWithException
returningnull
.static <T,E extends Exception>
ObjIntConsumerWithException<T,E>failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.default ObjIntConsumer<T>
ignore()
Converts thisObjIntConsumerWithException
to a liftedObjIntConsumer
ignoring exception.static <T,E extends Exception>
ObjIntConsumer<T>ignored(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to a liftedObjIntConsumer
ignoring exception.static <T,E extends Exception>
ObjIntConsumer<T>lifted(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to a liftedObjIntConsumer
ignoring exception.default BiFunction<T,Integer,CompletionStage<Void>>
stage()
Converts thisObjIntConsumerWithException
to a stagedBiFunction
that return aCompletionStage
.static <T,E extends Exception>
BiFunction<T,Integer,CompletionStage<Void>>staged(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to a stagedBiFunction
.default ObjIntConsumer<T>
uncheck()
Converts thisObjIntConsumerWithException
to aObjIntConsumer
that wraps exception toRuntimeException
.static <T,E extends Exception>
ObjIntConsumer<T>unchecked(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to aObjIntConsumer
that wraps exception toRuntimeException
.static <T,E extends Exception>
ObjIntConsumer<T>unchecked(ObjIntConsumerWithException<T,E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aObjIntConsumerWithException
to aObjIntConsumer
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, int 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:
ObjIntConsumer.accept(Object,int)
-
uncheck
default ObjIntConsumer<T> uncheck()
Converts thisObjIntConsumerWithException
to aObjIntConsumer
that wraps exception toRuntimeException
.- Specified by:
uncheck
in interfaceExceptionHandlerSupport<ObjIntConsumer<T>,ObjIntConsumer<T>,ObjIntConsumerWithException<T,E extends Exception>>
- Specified by:
uncheck
in interfaceNoReturnExceptionHandlerSupport<ObjIntConsumer<T>,BiFunction<T,Integer,CompletionStage<Void>>,ObjIntConsumerWithException<T,E extends Exception>>
- Returns:
- the unchecked operation
- See Also:
unchecked(ObjIntConsumerWithException)
,unchecked(ObjIntConsumerWithException, Function)
-
ignore
default ObjIntConsumer<T> ignore()
Converts thisObjIntConsumerWithException
to a liftedObjIntConsumer
ignoring exception.- Specified by:
ignore
in interfaceExceptionHandlerSupport<ObjIntConsumer<T>,ObjIntConsumer<T>,ObjIntConsumerWithException<T,E extends Exception>>
- Specified by:
ignore
in interfaceNoReturnExceptionHandlerSupport<ObjIntConsumer<T>,BiFunction<T,Integer,CompletionStage<Void>>,ObjIntConsumerWithException<T,E extends Exception>>
- Returns:
- the operation that ignore error
- See Also:
ignored(ObjIntConsumerWithException)
-
stage
default BiFunction<T,Integer,CompletionStage<Void>> stage()
Converts thisObjIntConsumerWithException
to a stagedBiFunction
that return aCompletionStage
.- Specified by:
stage
in interfaceNoReturnExceptionHandlerSupport<ObjIntConsumer<T>,BiFunction<T,Integer,CompletionStage<Void>>,ObjIntConsumerWithException<T,E extends Exception>>
- Returns:
- the staged operation.
- Since:
- 1.1.0
-
failing
static <T,E extends Exception> ObjIntConsumerWithException<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> ObjIntConsumer<T> unchecked(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to aObjIntConsumer
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(ObjIntConsumerWithException, Function)
-
unchecked
static <T,E extends Exception> ObjIntConsumer<T> unchecked(ObjIntConsumerWithException<T,E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aObjIntConsumerWithException
to aObjIntConsumer
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(ObjIntConsumerWithException)
-
lifted
static <T,E extends Exception> ObjIntConsumer<T> lifted(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to a liftedObjIntConsumer
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> ObjIntConsumer<T> ignored(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
to a liftedObjIntConsumer
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,Integer,CompletionStage<Void>> staged(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
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,Integer,E> asBiConsumer(ObjIntConsumerWithException<T,E> operation)
Converts aObjIntConsumerWithException
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
-
-