com.sun.ws.rest.api.core
Interface MultivaluedMap

All Superinterfaces:
java.util.Map<java.lang.String,java.util.List<java.lang.String>>

public interface MultivaluedMap
extends java.util.Map<java.lang.String,java.util.List<java.lang.String>>

A map of key-values pairs. Each key can have zero or more values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 void add(java.lang.String key, java.lang.Object value)
          Add a value to the current list of values for the supplied key.
<A> java.util.List<A>
get(java.lang.String key, java.lang.Class<A> type)
          Get the list of values for a particular key.
 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 shortcut to get the first value of the supplied key.
<A> A
getFirst(java.lang.String key, java.lang.Class<A> type)
          A shortcut to get the first value of the supplied key.
 void putSingle(java.lang.String key, java.lang.Object value)
          Set a value to be the single value in the current list of values for the supplied key.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

get

<A> java.util.List<A> get(java.lang.String key,
                          java.lang.Class<A> type)
Get the list of values for a particular key.

Parameters:
key - the key
type - the desired class of the member of the returned list. The class must have a constructor that accepts a single String argument.
Returns:
a list of values for the specified key or null if the key is not in the map

putSingle

void putSingle(java.lang.String key,
               java.lang.Object value)
Set a value to be the single value in the current list of values for the supplied key.

Parameters:
key - the key
value - the value to be putSingle, the object's toString method will be called to obtain a String value.
See Also:
Object.toString()

add

void add(java.lang.String key,
         java.lang.Object value)
Add a value to the current list of values for the supplied key.

Parameters:
key - the key
value - the value to be added, the object's toString method will be called to obtain a String value.
See Also:
Object.toString()

getFirst

java.lang.String getFirst(java.lang.String key)
A shortcut to get the first value of the supplied key.

Parameters:
key - the key
Returns:
the first value for the specified key or null if the key is not in the map.

getFirst

<A> A getFirst(java.lang.String key,
               java.lang.Class<A> type)
A shortcut to get the first value of the supplied key.

Parameters:
key - the key
type - the desired class of the returned value. The class must have a constructor that accepts a single String argument.
Returns:
the first value for the specified key or null if the key is not in the map.

getFirst

<A> A getFirst(java.lang.String key,
               A defaultValue)
A shortcut to get the first value of the supplied key.

Parameters:
key - the key
defaultValue - the default value that is the desired class of the returned value. The class must have a constructor that accepts a single String argument.
Returns:
the first value for the specified key or the default value if the key is not in the map.