Package com.google.gwt.storage.client
Class StorageImpl
java.lang.Object
com.google.gwt.storage.client.StorageImpl
- Direct Known Subclasses:
StorageImplNonNativeEvents
This is the HTML5 Storage implementation according to the standard
recommendation.
Never use this class directly, instead use Storage.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static JavaScriptObjectstatic final Stringstatic final Stringprotected static List<StorageEvent.Handler> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThis class can never be instantiated by itself. -
Method Summary
Modifier and TypeMethodDescriptionRegisters an event handler for StorageEvents.protected voidvoidRemoves all items in the Storage.Returns the item in the Storage associated with the specified key.intReturns the number of items in this Storage.protected List<StorageEvent.Handler>protected StoragegetStorageFromEvent(StorageEvent event) Returns theStorageobject that was affected in the event.protected static final voidhandleStorageEvent(StorageEvent event) Handles StorageEvents if aStorageEvent.Handleris registered.protected static booleanReturnstrueif at least one StorageEvent handler is registered,falseotherwise.Returns the key at the specified index.voidremoveItem(String storage, String key) Removes the item in the Storage associated with the specified key.voidDe-registers an event handler for StorageEvents.protected voidvoidSets the value in the Storage associated with the specified key to the specified data.
-
Field Details
-
LOCAL_STORAGE
- See Also:
-
SESSION_STORAGE
- See Also:
-
storageEventHandlers
-
jsHandler
-
-
Constructor Details
-
StorageImpl
protected StorageImpl()This class can never be instantiated by itself.
-
-
Method Details
-
handleStorageEvent
Handles StorageEvents if aStorageEvent.Handleris registered. -
hasStorageEventHandlers
protected static boolean hasStorageEventHandlers()Returnstrueif at least one StorageEvent handler is registered,falseotherwise. -
addStorageEventHandler
Registers an event handler for StorageEvents.- Parameters:
handler-- Returns:
HandlerRegistrationused to remove this handler- See Also:
-
clear
Removes all items in the Storage.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGE- See Also:
-
getItem
Returns the item in the Storage associated with the specified key.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGEkey- the key to a value in the Storage- Returns:
- the value associated with the given key
- See Also:
-
getLength
Returns the number of items in this Storage.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGE- Returns:
- number of items in this Storage
- See Also:
-
key
Returns the key at the specified index.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGEindex- the index of the key- Returns:
- the key at the specified index in this Storage
- See Also:
-
removeItem
Removes the item in the Storage associated with the specified key.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGEkey- the key to a value in the Storage- See Also:
-
removeStorageEventHandler
De-registers an event handler for StorageEvents.- Parameters:
handler-- See Also:
-
setItem
Sets the value in the Storage associated with the specified key to the specified data.- Parameters:
storage- eitherLOCAL_STORAGEorSESSION_STORAGEkey- the key to a value in the Storagedata- the value associated with the key- See Also:
-
addStorageEventHandler0
protected void addStorageEventHandler0() -
getStorageEventHandlers
-
getStorageFromEvent
Returns theStorageobject that was affected in the event.- Returns:
- the
Storageobject that was affected in the event.
-
removeStorageEventHandler0
protected void removeStorageEventHandler0()
-