Class MapBasedParser<T>
java.lang.Object
net.apartium.cocoabeans.commands.parsers.ArgumentParser<T>
net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser<T>
net.apartium.cocoabeans.commands.parsers.MapBasedParser<T>
- Type Parameters:
T- result type
- All Implemented Interfaces:
Comparable<ArgumentParser<?>>
Map-based parser that map of keyword to value
When Map entry not found report
NoSuchElementInMapResponse
Unlike ContextualMapBasedParser MapBasedParser doesn't care for context- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
ArgumentParser.ParseResult<T>, ArgumentParser.TabCompletionResult -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMapBasedParser(String keyword, Class<T> clazz, int priority) ConstructorprotectedMapBasedParser(String keyword, Class<T> clazz, int priority, boolean ignoreCase) Constructor with ignoreCaseprotectedMapBasedParser(String keyword, Class<T> clazz, int priority, boolean ignoreCase, boolean lax) Constructor with ignoreCase and lax -
Method Summary
Methods inherited from class net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser
parse, tabCompletion, tryParseMethods inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
compareTo, getArgumentType, getKeyword, getPriority
-
Constructor Details
-
MapBasedParser
Constructor- Parameters:
keyword- keywordclazz- result classpriority- priority
-
MapBasedParser
@AvailableSince("0.0.30") protected MapBasedParser(String keyword, Class<T> clazz, int priority, boolean ignoreCase) Constructor with ignoreCase- Parameters:
keyword- keywordclazz- result classpriority- priorityignoreCase- whether is it case-sensitive or not
-
MapBasedParser
@AvailableSince("0.0.30") protected MapBasedParser(String keyword, Class<T> clazz, int priority, boolean ignoreCase, boolean lax) Constructor with ignoreCase and lax- Parameters:
keyword- keywordclazz- result classpriority- priorityignoreCase- whether is it case-sensitive or notlax- lazy mapping
-
-
Method Details
-
getMap
If you want to ignore case to be applied, then remember to lowercase the keyword- Returns:
- map of keyword to value
-
getMap
Description copied from class:ContextualMapBasedParserIf you want to ignore case to be applied, then remember to lowercase the keyword- Specified by:
getMapin classContextualMapBasedParser<T>- Parameters:
context- the context that you can use to change the map for it- Returns:
- map of keyword to value
-