class StorageImpl
extends java.lang.Object
Never use this class directly, instead use Storage
.
Modifier and Type | Field and Description |
---|---|
protected static JavaScriptObject |
jsHandler |
static java.lang.String |
LOCAL_STORAGE |
static java.lang.String |
SESSION_STORAGE |
protected static java.util.List<StorageEvent.Handler> |
storageEventHandlers |
Modifier | Constructor and Description |
---|---|
protected |
StorageImpl()
This class can never be instantiated by itself.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addStorageEventHandler(StorageEvent.Handler handler)
Registers an event handler for StorageEvents.
|
protected void |
addStorageEventHandler0() |
void |
clear(java.lang.String storage)
Removes all items in the Storage.
|
java.lang.String |
getItem(java.lang.String storage,
java.lang.String key)
Returns the item in the Storage associated with the specified key.
|
int |
getLength(java.lang.String storage)
Returns the number of items in this Storage.
|
protected java.util.List<StorageEvent.Handler> |
getStorageEventHandlers()
|
protected Storage |
getStorageFromEvent(StorageEvent event)
Returns the
Storage object that was affected in the event. |
protected static void |
handleStorageEvent(StorageEvent event)
Handles StorageEvents if a
StorageEvent.Handler is registered. |
protected static boolean |
hasStorageEventHandlers()
Returns
true if at least one StorageEvent handler is
registered, false otherwise. |
java.lang.String |
key(java.lang.String storage,
int index)
Returns the key at the specified index.
|
void |
removeItem(java.lang.String storage,
java.lang.String key)
Removes the item in the Storage associated with the specified key.
|
void |
removeStorageEventHandler(StorageEvent.Handler handler)
De-registers an event handler for StorageEvents.
|
protected void |
removeStorageEventHandler0() |
void |
setItem(java.lang.String storage,
java.lang.String key,
java.lang.String data)
Sets the value in the Storage associated with the specified key to the
specified data.
|
public static final java.lang.String LOCAL_STORAGE
public static final java.lang.String SESSION_STORAGE
protected static java.util.List<StorageEvent.Handler> storageEventHandlers
protected static JavaScriptObject jsHandler
protected StorageImpl()
protected static final void handleStorageEvent(StorageEvent event)
StorageEvent.Handler
is registered.protected static boolean hasStorageEventHandlers()
true
if at least one StorageEvent handler is
registered, false
otherwise.public HandlerRegistration addStorageEventHandler(StorageEvent.Handler handler)
handler
- HandlerRegistration
used to remove this handlerpublic void clear(java.lang.String storage)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
public java.lang.String getItem(java.lang.String storage, java.lang.String key)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
key
- the key to a value in the Storagepublic int getLength(java.lang.String storage)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
public java.lang.String key(java.lang.String storage, int index)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
index
- the index of the keypublic void removeItem(java.lang.String storage, java.lang.String key)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
key
- the key to a value in the Storagepublic void removeStorageEventHandler(StorageEvent.Handler handler)
handler
- public void setItem(java.lang.String storage, java.lang.String key, java.lang.String data)
storage
- either LOCAL_STORAGE
or SESSION_STORAGE
key
- the key to a value in the Storagedata
- the value associated with the keyprotected void addStorageEventHandler0()
protected java.util.List<StorageEvent.Handler> getStorageEventHandlers()
protected Storage getStorageFromEvent(StorageEvent event)
Storage
object that was affected in the event.Storage
object that was affected in the event.protected void removeStorageEventHandler0()