Class MapBasedParser<T>

Type Parameters:
T - result type
All Implemented Interfaces:
Comparable<ArgumentParser<?>>

public abstract class MapBasedParser<T> extends ContextualMapBasedParser<T>
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:
  • Constructor Details

    • MapBasedParser

      protected MapBasedParser(String keyword, Class<T> clazz, int priority)
      Constructor
      Parameters:
      keyword - keyword
      clazz - result class
      priority - priority
    • MapBasedParser

      @AvailableSince("0.0.30") protected MapBasedParser(String keyword, Class<T> clazz, int priority, boolean ignoreCase)
      Constructor with ignoreCase
      Parameters:
      keyword - keyword
      clazz - result class
      priority - priority
      ignoreCase - 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 - keyword
      clazz - result class
      priority - priority
      ignoreCase - whether is it case-sensitive or not
      lax - lazy mapping
  • Method Details

    • getMap

      public abstract Map<String,T> getMap()
      If you want to ignore case to be applied, then remember to lowercase the keyword
      Returns:
      map of keyword to value
    • getMap

      public Map<String,T> getMap(CommandProcessingContext context)
      Description copied from class: ContextualMapBasedParser
      If you want to ignore case to be applied, then remember to lowercase the keyword
      Specified by:
      getMap in class ContextualMapBasedParser<T>
      Parameters:
      context - the context that you can use to change the map for it
      Returns:
      map of keyword to value