- java.lang.Object
-
- com.github.rvesse.airline.parser.ParseResult<T>
-
- Type Parameters:
T
- Command type
public class ParseResult<T> extends java.lang.Object
Represents parsing results
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<ParseException>
errors
private ParseState<T>
state
-
Constructor Summary
Constructors Constructor Description ParseResult(ParseState<T> state, java.util.Collection<ParseException> errors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getCommand()
Gets the command if one was successfully parsedjava.util.Collection<ParseException>
getErrors()
Gets the collection of errors that occurred, may be empty if parsing was successfulParseState<T>
getState()
Gets the final parser stateboolean
wasSuccessful()
Indicates whether parsing was successful
-
-
-
Field Detail
-
state
private final ParseState<T> state
-
errors
private final java.util.Collection<ParseException> errors
-
-
Constructor Detail
-
ParseResult
public ParseResult(ParseState<T> state, java.util.Collection<ParseException> errors)
-
-
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 parsedNote 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
-
-