Class ParseResult<T>

java.lang.Object
com.github.rvesse.airline.parser.ParseResult<T>
Type Parameters:
T - Command type

public class ParseResult<T> extends Object
Represents parsing results
  • Field Details

  • Constructor Details

  • Method Details

    • 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 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