P
- parameter typeE
- exception type@FunctionalInterface
public interface FragileProcedure1<E extends java.lang.Exception,P>
Consumer
,
but in a more extensible way.
As it is extending Consumer
it can be used anywhere a Consumer
is expected.FragileProcedure0
,
FragileProcedure2
,
FragileProcedure3
,
Procedure1
Modifier and Type | Field and Description |
---|---|
static FragileProcedure1<?,?> |
NULL
Procedure with one argument which does nothing, not even throwing.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(P arg)
Run the function.
|
default void |
applyNonNull(P argument)
Apply this procedure only if the argument is not
null . |
static <X extends java.lang.Exception,T> |
empty()
Return a procedure which does nothing, not even throw.
|
default Procedure1<P> |
nonFragile()
Convert this to a non-fragile procedure which does not throw a checked exception.
|
default Procedure1<P> |
nonFragileX(java.util.function.BiConsumer<? super E,? super P> exceptionHandler)
Convert this to a non-fragile procedure which does not a checked exception.
|
default FragileProcedure0<E> |
partial(P argument)
Return a partial evaluation of this procedure.
|
@NotNull static final FragileProcedure1<?,?> NULL
empty()
instead.void apply(P arg) throws E extends java.lang.Exception
arg
- function argumentE
- exceptionE extends java.lang.Exception
@NotNull default Procedure1<P> nonFragile()
WrappedFragileException
for any
checked exception thrown during apply(Object)
.Procedure1.nonFragile(FragileProcedure1)
@NotNull default Procedure1<P> nonFragileX(@NotNull java.util.function.BiConsumer<? super E,? super P> exceptionHandler)
WrappedFragileException
for any
checked exception thrown during apply(Object)
.exceptionHandler
- handler called when an exception is encountered.
It may either ignore it, throw an unchecked exception,
or collect the exceptionsProcedure1.nonFragileX(FragileProcedure1, BiConsumer)
default void applyNonNull(@Nullable P argument) throws E extends java.lang.Exception
null
.
Using this invocation it is guaranteed that apply(Object)
will always be called with
a non-null argument.
Use Types.notNull(Object, Object)
if yo want to invoke this
with a default argument when argument
is null
.
argument
- argument of this function, possibly null
E
- exceptionE extends java.lang.Exception
@NotNull default FragileProcedure0<E> partial(P argument)
argument
- constant argument use for the evaluation@NotNull static <X extends java.lang.Exception,T> FragileProcedure1<X,T> empty()
NULL
, but the compiler will accept it smoothly.X
- exception typeT
- argument type