T - the value type@NonnullByDefault public interface ArgumentParser<T>
| Modifier and Type | Method and Description |
|---|---|
default Optional<T> |
parse(Argument argument)
Tries to parse the value from the argument
|
Optional<T> |
parse(String s)
Parses the value from a string
|
default T |
parseOrFail(Argument argument)
Parses the value from an argument, throwing an interrupt exception if
parsing failed.
|
default T |
parseOrFail(String s)
Parses the value from a string, throwing an interrupt exception if
parsing failed.
|
default ArgumentParser<T> |
thenTry(ArgumentParser<T> other)
Creates a new parser which first tries to obtain a value from
this parser, then from another if the former was not successful.
|
Optional<T> parse(@Nonnull String s)
s - the string@Nonnull default T parseOrFail(@Nonnull String s) throws CommandInterruptException
s - the stringCommandInterruptException@Nonnull default Optional<T> parse(@Nonnull Argument argument)
argument - the argument@Nonnull default T parseOrFail(@Nonnull Argument argument) throws CommandInterruptException
argument - the argumentCommandInterruptException@Nonnull default ArgumentParser<T> thenTry(@Nonnull ArgumentParser<T> other)
other - the other parserCopyright © 2017. All rights reserved.