Class ParameterMap


  • public class ParameterMap
    extends Object
    Parameter (name=value pair) manipulation. In particular, this utility supports multiple parameters with the same name: xxx=value1&xxx=value2
    • Constructor Detail

      • ParameterMap

        public ParameterMap()
        Public constructor
    • Method Detail

      • clear

        public void clear()
        Empty the parameter map
      • getParameterMapIterator

        public Iterator getParameterMapIterator()
        Get an Iterator to the parameter map
        Returns:
        Map iterator
      • nextParameterMapEntry

        public boolean nextParameterMapEntry​(Iterator iterator)
        Save the next Entry Set for this Iterator
        Parameters:
        iterator - Parameter map iterator
        Returns:
        false If no more entries exist
      • getParameterNameFromIterator

        public String getParameterNameFromIterator()
        Get the parameter name from the current iterator
        Returns:
        Item name
      • getParameterValueFromIterator

        public String getParameterValueFromIterator()
        Get the parameter value from the current iterator
        Returns:
        Item value
      • setParameterMapValue

        public void setParameterMapValue​(String name,
                                         String value)
        Set a name/value pair
        Parameters:
        name - Item name
        value - Item value
      • getParameterMapValue

        public String getParameterMapValue​(String name)
        Get a named value from the parameter map
        Parameters:
        name - Item name
        Returns:
        Item value (a String, null if none)
      • getParameterMapName

        public String getParameterMapName​(String value)
        Get the parameter name associated with the 1st occurance of this value
        Parameters:
        value - Item value
        Returns:
        Item name (a String, null if none)
      • populateMapFromUrlArguments

        public int populateMapFromUrlArguments​(String url,
                                               String delimiter)
        Populate a parameter map from an URL argument list. Any of:

        http://x.y.com?xxx=yyy&aaa=bbb
        ?xxx=yyy&aaa=bbb
        xxx=yyy&aaa=bbb

        Will populated the map as: xxx=yyy aaa=bbb

        Parameters:
        url - Original URL [with optional parameter list] or only the parameter list [with an optional ? prefix]
        delimiter - Argument separator text (regular expression)
        Returns:
        Number of parameters saved