Package com.mrivanplays.jdcf.args
Class RestArgumentAction
- java.lang.Object
-
- com.mrivanplays.jdcf.args.RestArgumentAction
-
public final class RestArgumentAction extends java.lang.ObjectRepresents a rest action, which comes role when the argument you wanted to get back in the code chain is null. This provides aorElse(Consumer)method, which is being called only when there was no value present back.
-
-
Constructor Summary
Constructors Constructor Description RestArgumentAction(FailReason failReason, java.lang.String argument)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactionTook()Returns whenever an action was took on the rest argument or not.voidorElse(@NotNull java.lang.Runnable runnable)The specifiedRunnablegets invoked whatever theFailReasonwas when the value wasn't present.voidorElse(@NotNull java.util.function.BiConsumer<FailReason,java.lang.String> toRun)voidorElse(@NotNull java.util.function.Consumer<FailReason> toRun)The specifiedConsumergets invoked with theFailReasonwhen the value wasn't present.booleanwasValuePresent()Returns whenever the value was present.
-
-
-
Constructor Detail
-
RestArgumentAction
public RestArgumentAction(FailReason failReason, java.lang.String argument)
-
-
Method Detail
-
wasValuePresent
public boolean wasValuePresent()
Returns whenever the value was present.- Returns:
trueif present,falseotherwise
-
orElse
public void orElse(@NotNull @NotNull java.util.function.Consumer<FailReason> toRun)The specifiedConsumergets invoked with theFailReasonwhen the value wasn't present.- Parameters:
toRun- the action to run
-
orElse
public void orElse(@NotNull @NotNull java.util.function.BiConsumer<FailReason,java.lang.String> toRun)The specifiedBiConsumergets invoked with theFailReasonand the specifiedStringargument. Depending on the fail reason, the argument may or may not be null.- Parameters:
toRun- the action to run
-
actionTook
public boolean actionTook()
Returns whenever an action was took on the rest argument or not.- Returns:
trueif action took,falseif not
-
orElse
public void orElse(@NotNull @NotNull java.lang.Runnable runnable)The specifiedRunnablegets invoked whatever theFailReasonwas when the value wasn't present.- Parameters:
runnable- the runnable to run
-
-