|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<java.lang.String,java.lang.String> com.google.gwt.storage.client.StorageMap
public class StorageMap
Exposes the local/session Storage
as a standard Map<String, String>
.
Experimental API: This API is still under development and is subject to change.
The following characteristics are associated with this Map:
put(String, String)
,
AbstractMap.putAll(Map)
, remove(Object)
, clear()
,
Entry#setValue(Object)
) operate as intended;AbstractMap.keySet()
, entrySet()
and AbstractMap.values()
)
operate as intended;null
values and keys - The Storage doesn't
accept keys or values which are null
;
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 | |
---|---|
StorageMap(Storage storage)
Creates the Map with the specified Storage as data provider. |
Method Summary | |
---|---|
void |
clear()
Removes all items from the Storage. |
boolean |
containsKey(java.lang.Object key)
Returns true if the Storage contains the specified key,
false otherwise. |
boolean |
containsValue(java.lang.Object value)
Returns true if the Storage contains the specified value,
false otherwise (or if the specified key is null
). |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entrySet()
Returns a Set containing all entries of the Storage. |
java.lang.String |
get(java.lang.Object key)
Returns the value associated with the specified key in the Storage. |
java.lang.String |
put(java.lang.String key,
java.lang.String value)
Adds (or overwrites) a new key/value pair in the Storage. |
java.lang.String |
remove(java.lang.Object key)
Removes the key/value pair from the Storage. |
int |
size()
Returns the number of items in the Storage. |
Methods inherited from class java.util.AbstractMap |
---|
clone, equals, hashCode, isEmpty, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StorageMap(Storage storage)
storage
- a local/session Storage instance obtained by either
Storage.getLocalStorageIfSupported()
or
Storage.getSessionStorageIfSupported()
.Method Detail |
---|
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.String>
clear
in class java.util.AbstractMap<java.lang.String,java.lang.String>
Storage.clear()
public boolean containsKey(java.lang.Object key)
true
if the Storage contains the specified key,
false
otherwise.
containsKey
in interface java.util.Map<java.lang.String,java.lang.String>
containsKey
in class java.util.AbstractMap<java.lang.String,java.lang.String>
public boolean containsValue(java.lang.Object value)
true
if the Storage contains the specified value,
false
otherwise (or if the specified key is null
).
containsValue
in interface java.util.Map<java.lang.String,java.lang.String>
containsValue
in class java.util.AbstractMap<java.lang.String,java.lang.String>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.String>
entrySet
in class java.util.AbstractMap<java.lang.String,java.lang.String>
public java.lang.String get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.String>
get
in class java.util.AbstractMap<java.lang.String,java.lang.String>
key
- the key identifying the valueStorage.getItem(String)
public java.lang.String put(java.lang.String key, java.lang.String value)
put
in interface java.util.Map<java.lang.String,java.lang.String>
put
in class java.util.AbstractMap<java.lang.String,java.lang.String>
key
- the key identifying the value (not null
)value
- the value associated with the key (not null
)Storage.setItem(String, String)
public java.lang.String remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.String>
remove
in class java.util.AbstractMap<java.lang.String,java.lang.String>
key
- the key identifying the item to remove
null
if the key
was not present in the StorageStorage.removeItem(String)
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.String>
size
in class java.util.AbstractMap<java.lang.String,java.lang.String>
Storage.getLength()
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |