Errai 3.0.1-SNAPSHOT

org.jboss.errai.jpa.client.local.backend
Class LocalStorage

java.lang.Object
  extended by org.jboss.errai.jpa.client.local.backend.LocalStorage

public class LocalStorage
extends Object

Provides access to the methods of the standard Window.localStorage object available in most browsers. Works much like java.util.Map, but the contents of the map persist indefinitely within the browser, like cookies do (even if the page is closed and reopened days, weeks, or years later).

Author:
Jonathan Fuerth

Constructor Summary
LocalStorage()
           
 
Method Summary
static void forEachKey(EntryVisitor entryVisitor)
          Invokes the given entry visitor on each key/value pair in this entire storage backend.
static String get(String key)
          Retrieves the value associated with the given key.
static void put(String key, String value)
          Puts the given key-value mapping into storage, replacing any previously existing mapping.
static String remove(String key)
          Removes the key-value mapping associated with the given key, if any.
static void removeAll()
          Removes all key-value mappings from storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalStorage

public LocalStorage()
Method Detail

put

public static void put(String key,
                       String value)
Puts the given key-value mapping into storage, replacing any previously existing mapping.

Parameters:
key - The key for the mapping. Must not be null.
value - The value to associate with key. Null is permitted.

get

public static String get(String key)
Retrieves the value associated with the given key.

Parameters:
key - The key for the mapping. Must not be null.
Returns:
The value associated with key, or null if the key is not present.

remove

public static String remove(String key)
Removes the key-value mapping associated with the given key, if any.

Parameters:
key - The key for the mapping. Must not be null.
Returns:
The value that was associated with key, or null if the key was not present.

removeAll

public static void removeAll()
Removes all key-value mappings from storage.


forEachKey

public static void forEachKey(EntryVisitor entryVisitor)
Invokes the given entry visitor on each key/value pair in this entire storage backend.

Parameters:
entryVisitor - The visitor that will act on each key/value pair.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.