Class ArgumentParseResult<T>

  • Type Parameters:
    T - Parser return type

    public abstract class ArgumentParseResult<T>
    extends java.lang.Object
    Result of the parsing done by a ArgumentParser
    • Method Summary

      Modifier and Type Method Description
      static <T> @NonNull ArgumentParseResult<T> failure​(@NonNull java.lang.Throwable failure)
      Indicate that the parsing failed
      abstract @NonNull java.util.Optional<java.lang.Throwable> getFailure()
      Get the failure reason, if it exists
      abstract @NonNull java.util.Optional<T> getParsedValue()
      Get the parsed value, if it exists
      static <T> @NonNull ArgumentParseResult<T> success​(@NonNull T value)
      Indicate that the parsing succeeded
      • Methods inherited from class java.lang.Object

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

      • failure

        public static <T> @NonNull ArgumentParseResult<T> failure​(@NonNull java.lang.Throwable failure)
        Indicate that the parsing failed
        Type Parameters:
        T - Parser return type
        Parameters:
        failure - Failure reason
        Returns:
        Failed parse result
      • success

        public static <T> @NonNull ArgumentParseResult<T> success​(@NonNull T value)
        Indicate that the parsing succeeded
        Type Parameters:
        T - Parser return type
        Parameters:
        value - Value produced by the parser
        Returns:
        Succeeded parse result
      • getParsedValue

        public abstract @NonNull java.util.Optional<T> getParsedValue()
        Get the parsed value, if it exists
        Returns:
        Optional containing the parsed value
      • getFailure

        public abstract @NonNull java.util.Optional<java.lang.Throwable> getFailure()
        Get the failure reason, if it exists
        Returns:
        Optional containing the failure reason