Class RestArgumentAction


  • public final class RestArgumentAction
    extends java.lang.Object
    Represents a rest action, which comes role when the argument you wanted to get back in the code chain is null. This provides a orElse(Consumer) method, which is being called only when there was no value present back.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean actionTook()
      Returns whenever an action was took on the rest argument or not.
      void orElse​(@NotNull java.lang.Runnable runnable)
      The specified Runnable gets invoked whatever the FailReason was when the value wasn't present.
      void orElse​(@NotNull java.util.function.BiConsumer<FailReason,​java.lang.String> toRun)
      The specified BiConsumer gets invoked with the FailReason and the specified String argument.
      void orElse​(@NotNull java.util.function.Consumer<FailReason> toRun)
      The specified Consumer gets invoked with the FailReason when the value wasn't present.
      boolean wasValuePresent()
      Returns whenever the value was present.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RestArgumentAction

        public RestArgumentAction​(FailReason failReason,
                                  java.lang.String argument)
    • Method Detail

      • wasValuePresent

        public boolean wasValuePresent()
        Returns whenever the value was present.
        Returns:
        true if present, false otherwise
      • orElse

        public void orElse​(@NotNull
                           @NotNull java.util.function.Consumer<FailReason> toRun)
        The specified Consumer gets invoked with the FailReason when 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 specified BiConsumer gets invoked with the FailReason and the specified String argument. 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:
        true if action took, false if not
      • orElse

        public void orElse​(@NotNull
                           @NotNull java.lang.Runnable runnable)
        The specified Runnable gets invoked whatever the FailReason was when the value wasn't present.
        Parameters:
        runnable - the runnable to run