Package picocli

Class CommandLine.Model.CaseAwareLinkedMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
picocli.CommandLine.Model.CaseAwareLinkedMap<K,V>
Type Parameters:
V - type of the value
All Implemented Interfaces:
Map<K,V>
Enclosing class:
CommandLine.Model

static class CommandLine.Model.CaseAwareLinkedMap<K,V> extends AbstractMap<K,V>
This class provides a case-aware Linked HashMap. Supports both case-sensitive and case-insensitive modes.
  • Field Details

    • targetMap

      private final LinkedHashMap<K,V> targetMap
    • keyMap

      private final HashMap<K,K> keyMap
    • keySet

      private final Set<K> keySet
    • caseInsensitive

      private boolean caseInsensitive
    • locale

      private final Locale locale
  • Constructor Details

    • CaseAwareLinkedMap

      public CaseAwareLinkedMap()
      Constructs an empty CaseAwareLinkedMap instance with Locale.ENGLISH.
    • CaseAwareLinkedMap

      public CaseAwareLinkedMap(Locale locale)
      Constructs an empty CaseAwareLinkedMap instance with the specified Locale.
      Parameters:
      locale - the locale to convert character cases
    • CaseAwareLinkedMap

      public CaseAwareLinkedMap(CommandLine.Model.CaseAwareLinkedMap<? extends K,? extends V> map)
      Constructs a CaseAwareLinkedMap instance with the same mappings, case-sensitivity and locale as the specified map.
      Parameters:
      map - the map whose mappings, case-sensitivity and locale are to be placed in this map
      Throws:
      NullPointerException - if the specified map is null
  • Method Details

    • isCaseConvertible

      static boolean isCaseConvertible(Class<?> clazz)
    • toLowerCase

      private K toLowerCase(Object caseSensitiveKey)
    • isCaseInsensitive

      public boolean isCaseInsensitive()
      Returns the case-insensitivity of the map.
    • setCaseInsensitive

      public void setCaseInsensitive(boolean caseInsensitive)
      Sets the case-insensitivity of the map.
    • getLocale

      public Locale getLocale()
      Returns the locale of the map.
    • getCaseSensitiveKey

      public K getCaseSensitiveKey(K caseInsensitiveKey)
      Returns the case-sensitive key of the specified case-insensitive key if isCaseSensitive(). Otherwise, the specified case-insensitive key is returned.
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
      Overrides:
      size in class AbstractMap<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
      Overrides:
      containsKey in class AbstractMap<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
      Overrides:
      containsValue in class AbstractMap<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class AbstractMap<K,V>
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class AbstractMap<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class AbstractMap<K,V>
    • keySet

      public Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
      Overrides:
      keySet in class AbstractMap<K,V>
    • values

      public Collection<V> values()
      Specified by:
      values in interface Map<K,V>
      Overrides:
      values in class AbstractMap<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in class AbstractMap<K,V>