com.sun.jersey.core.util
Class MultivaluedMapImpl

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.util.List<java.lang.String>>
          extended by com.sun.jersey.core.util.MultivaluedMapImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.util.List<java.lang.String>>, MultivaluedMap<java.lang.String,java.lang.String>
Direct Known Subclasses:
Form

public class MultivaluedMapImpl
extends java.util.HashMap<java.lang.String,java.util.List<java.lang.String>>
implements MultivaluedMap<java.lang.String,java.lang.String>

An implementation of MultivaluedMap where keys and values are instances of String.

Author:
Paul.Sandoz@Sun.Com
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MultivaluedMapImpl()
           
MultivaluedMapImpl(MultivaluedMap<java.lang.String,java.lang.String> that)
           
 
Method Summary
 void add(java.lang.String key, java.lang.Object value)
           
 void add(java.lang.String key, java.lang.String value)
          Add a value to the current list of values for the supplied key.
 void addFirst(java.lang.String key, java.lang.String value)
           
<A> java.util.List<A>
get(java.lang.String key, java.lang.Class<A> type)
           
 java.lang.String getFirst(java.lang.String key)
          A shortcut to get the first value of the supplied key.
<A> A
getFirst(java.lang.String key, A defaultValue)
           
<A> A
getFirst(java.lang.String key, java.lang.Class<A> type)
           
 void putSingle(java.lang.String key, java.lang.Object value)
           
 void putSingle(java.lang.String key, java.lang.String value)
          Set the key's value to be a one item list consisting of the supplied value.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

MultivaluedMapImpl

public MultivaluedMapImpl()

MultivaluedMapImpl

public MultivaluedMapImpl(MultivaluedMap<java.lang.String,java.lang.String> that)
Method Detail

putSingle

public final void putSingle(java.lang.String key,
                            java.lang.String value)
Description copied from interface: MultivaluedMap
Set the key's value to be a one item list consisting of the supplied value. Any existing values will be replaced.

Specified by:
putSingle in interface MultivaluedMap<java.lang.String,java.lang.String>
Parameters:
key - the key
value - the single value of the key

add

public final void add(java.lang.String key,
                      java.lang.String value)
Description copied from interface: MultivaluedMap
Add a value to the current list of values for the supplied key.

Specified by:
add in interface MultivaluedMap<java.lang.String,java.lang.String>
Parameters:
key - the key
value - the value to be added.

getFirst

public final java.lang.String getFirst(java.lang.String key)
Description copied from interface: MultivaluedMap
A shortcut to get the first value of the supplied key.

Specified by:
getFirst in interface MultivaluedMap<java.lang.String,java.lang.String>
Parameters:
key - the key
Returns:
the first value for the specified key or null if the key is not in the map.

addFirst

public final void addFirst(java.lang.String key,
                           java.lang.String value)

get

public final <A> java.util.List<A> get(java.lang.String key,
                                       java.lang.Class<A> type)

putSingle

public final void putSingle(java.lang.String key,
                            java.lang.Object value)

add

public final void add(java.lang.String key,
                      java.lang.Object value)

getFirst

public final <A> A getFirst(java.lang.String key,
                            java.lang.Class<A> type)

getFirst

public final <A> A getFirst(java.lang.String key,
                            A defaultValue)


Copyright © 2011 Oracle Corporation. All Rights Reserved.