org.apache.pivot.web
Class QueryDictionary

java.lang.Object
  extended by org.apache.pivot.web.QueryDictionary
All Implemented Interfaces:
Iterable<String>, Dictionary<String,String>

public final class QueryDictionary
extends Object
implements Dictionary<String,String>, Iterable<String>

Represents a collection of keyed data associated with a query. Allows multiple values to be set against a given key.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary
Dictionary.Pair<K,V>
 
Constructor Summary
QueryDictionary(boolean caseSensitiveKeys)
           
 
Method Summary
 int add(String key, String value)
           
 void clear()
           
 boolean containsKey(String key)
          Tests the existence of a key in the dictionary.
 String get(String key)
          Retrieves the value for the given key.
 String get(String key, int index)
           
 int getLength(String key)
           
 void insert(String key, String value, int index)
           
 Iterator<String> iterator()
           
 String put(String key, String value)
          Sets the value of the given key, creating a new entry or replacing the existing value.
 String remove(String key)
          Removes a key/value pair from the map.
 String remove(String key, int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryDictionary

public QueryDictionary(boolean caseSensitiveKeys)
Method Detail

get

public String get(String key)
Description copied from interface: Dictionary
Retrieves the value for the given key.

Specified by:
get in interface Dictionary<String,String>
Parameters:
key - The key whose value is to be returned.
Returns:
The value corresponding to key, or null if the key does not exist. Will also return null if the key refers to a null value. Use containsKey() to distinguish between these two cases.

get

public String get(String key,
                  int index)

put

public String put(String key,
                  String value)
Description copied from interface: Dictionary
Sets the value of the given key, creating a new entry or replacing the existing value.

Specified by:
put in interface Dictionary<String,String>
Parameters:
key - The key whose value is to be set.
value - The value to be associated with the given key.
Returns:
The value previously associated with the key.

add

public int add(String key,
               String value)

insert

public void insert(String key,
                   String value,
                   int index)

remove

public String remove(String key)
Description copied from interface: Dictionary
Removes a key/value pair from the map.

Specified by:
remove in interface Dictionary<String,String>
Parameters:
key - The key whose mapping is to be removed.
Returns:
The value that was removed.

remove

public String remove(String key,
                     int index)

clear

public void clear()

containsKey

public boolean containsKey(String key)
Description copied from interface: Dictionary
Tests the existence of a key in the dictionary.

Specified by:
containsKey in interface Dictionary<String,String>
Parameters:
key - The key whose presence in the dictionary is to be tested.
Returns:
true if the key exists in the dictionary; false, otherwise.

getLength

public int getLength(String key)

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>