Package io.permazen.cli.parse
Class WordParser
java.lang.Object
io.permazen.cli.parse.WordParser
Parses a word (one or more characters).
-
Constructor Summary
ConstructorsConstructorDescriptionWordParser(String description) Constructor when any word is acceptable.WordParser(Collection<String> words, String description) Constructor for when there's a fixed set of possibilities. -
Method Summary
-
Constructor Details
-
WordParser
Constructor for when there's a fixed set of possibilities.- Parameters:
words- words to look fordescription- what to call words (e.g., "command")- Throws:
IllegalArgumentException- ifwordsis nullIllegalArgumentException- ifdescriptionis null
-
WordParser
Constructor when any word is acceptable.- Parameters:
description- what to call words (e.g., "command")- Throws:
IllegalArgumentException- ifwordsis nullIllegalArgumentException- ifdescriptionis null
-
-
Method Details
-
getWords
Get the set of valid words, if there is such a set.The implementation in
WordParserreturns the collection provided to the constructor, if any.- Returns:
- collection of valid words, or null to not place any restriction
-
parse
Description copied from interface:ParserParse value from the given text.
-