org.exoplatform.services.rest
Class MultivaluedMetadata

java.lang.Object
  extended by org.exoplatform.services.rest.MultivaluedMetadata

public class MultivaluedMetadata
extends Object

Created by The eXo Platform SAS .
A map of key-value pair. Each key can have few value.

Version:
$Id: $
Author:
Gennady Azarenkov

Constructor Summary
MultivaluedMetadata()
          Constructs an empty MultivaluedMetadata.
MultivaluedMetadata(HashMap<String,List<String>> data)
          Constructs a new MultivaluedMetadata with the same mappings as the specified data.
 
Method Summary
 String get(String key)
          Return values and values convert from List<String> to the String.
 HashMap<String,String> getAll()
          Return the all pair key-values and values convert from List <String> to the String.
 String getFirst(String key)
          Return the first value of the key.
 List<String> getList(String key)
          Return values represented by List<String>.
 boolean has(String key)
          Check is there descriptor with specified key.
 Set<String> keys()
          Get keys of HashMap.
 void put(String key, List<String> vals)
          Set key's value to one item list of values.
 void putSingle(String key, String value)
          Add one more value to the current list of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultivaluedMetadata

public MultivaluedMetadata()
Constructs an empty MultivaluedMetadata.


MultivaluedMetadata

public MultivaluedMetadata(HashMap<String,List<String>> data)
Constructs a new MultivaluedMetadata with the same mappings as the specified data.

Parameters:
data - the map whose mappings are to be placed in this data.
Method Detail

put

public void put(String key,
                List<String> vals)
Set key's value to one item list of values.

Parameters:
key - the key.
vals - the value.

putSingle

public void putSingle(String key,
                      String value)
Add one more value to the current list of values.

Parameters:
key - the key.
value - the value to be add.

getFirst

public String getFirst(String key)
Return the first value of the key.

Parameters:
key - the key.
Returns:
the value.

getAll

public HashMap<String,String> getAll()
Return the all pair key-values and values convert from List <String> to the String. This may be used to set HTTP headers.

Returns:
key-valies pair represet by HashMap.

get

public String get(String key)
Return values and values convert from List<String> to the String. This may be used to set HTTP headers.

Parameters:
key - the key.
Returns:
the value.

getList

public List<String> getList(String key)
Return values represented by List<String>.

Parameters:
key - the key.
Returns:
the value.

keys

public Set<String> keys()
Get keys of HashMap.

Returns:
keys.

has

public boolean has(String key)
Check is there descriptor with specified key.

Parameters:
key - the descriptor key.
Returns:
true if value with specified key exist false otherwise.


Copyright © 2009 eXo Platform SAS. All Rights Reserved.