Class EnumMapping


  • public class EnumMapping
    extends Object
    Helper class for enums.
    • Constructor Detail

      • EnumMapping

        public EnumMapping()
    • Method Detail

      • addMapping

        public void addMapping​(String key,
                               String value)
        Adds a key/value mapping
      • fromKey

        public String fromKey​(String key)
        Retrieves the value associated with the given key.
        Parameters:
        key - the key to look up
        Returns:
        the value mapped to the given key, or null if no mapping exists
      • fromValue

        public String fromValue​(String value)
        Retrieves the key associated with the given value.
        Parameters:
        value - the value to look up
        Returns:
        the key mapped to the given value, or null if no mapping exists
      • fromValue

        public String fromValue​(String value,
                                boolean matchCase)
        Retrieves the key associated with the given value.
        Parameters:
        value - the value to look up
        matchCase - true to perform a case-sensitive lookup, false otherwise
        Returns:
        the key mapped to the given value, or null if no mapping exists
      • keyToValueMap

        public Map<String,​String> keyToValueMap()
        Returns an unmodifiable view of the key-to-value mappings.
        Returns:
        an unmodifiable Map containing the key-to-value mappings
      • valueToKeyMap

        public Map<String,​String> valueToKeyMap()
        Returns an unmodifiable view of the value-to-key mappings.
        Returns:
        an unmodifiable Map containing the value-to-key mappings