Package io.permazen.cli.parse
Class WordParser
java.lang.Object
io.permazen.cli.parse.WordParser
Parses a word (one or more characters).
-
Constructor Summary
ConstructorDescriptionWordParser
(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
- ifwords
is nullIllegalArgumentException
- ifdescription
is null
-
WordParser
Constructor when any word is acceptable.- Parameters:
description
- what to call words (e.g., "command")- Throws:
IllegalArgumentException
- ifwords
is nullIllegalArgumentException
- ifdescription
is null
-
-
Method Details
-
getWords
Get the set of valid words, if there is such a set.The implementation in
WordParser
returns 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:Parser
Parse value from the given text.
-