Class ParseResult<T>

  • Type Parameters:
    T - Command type

    public class ParseResult<T>
    extends java.lang.Object
    Represents parsing results
    • Method Detail

      • wasSuccessful

        public boolean wasSuccessful()
        Indicates whether parsing was successful
        Returns:
        True if successful, false if any errors occurred
      • getState

        public ParseState<T> getState()
        Gets the final parser state
        Returns:
        Parser state
      • getErrors

        public java.util.Collection<ParseException> getErrors()
        Gets the collection of errors that occurred, may be empty if parsing was successful
        Returns:
        Errors
      • getCommand

        public T getCommand()
        Gets the command if one was successfully parsed

        Note that a command may have been parsed even when errors have been detected and handled by the error handler. Therefore you should check wasSuccessful() and act accordingly before assuming that it is safe to run the parsed command.

        Returns:
        Command, or null if no command was parsed