public class StorageWriteProxy<K,V> extends Object implements DataProxy<StorageWriteProxy.Entry<K,V>,Void>
Modifier and Type | Class and Description |
---|---|
static class |
StorageWriteProxy.Entry<K,V>
Defines a key / value pair.
|
Constructor and Description |
---|
StorageWriteProxy(boolean session)
Creates a storage write proxy that saves a key and value to HTML5 browser
based storage.
|
StorageWriteProxy(Storage storage)
Creates a storage write proxy that saves a key and value to the given HTML5
browser based storage.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getEncodedKey(K key) |
protected String |
getEncodedValue(V value) |
DataWriter<K,String> |
getKeyWriter()
Returns the current
DataWriter used for converting key instances
into Strings |
DataWriter<V,String> |
getValueWriter()
Returns the current
DataWriter used for converting value instances
into Strings |
void |
load(StorageWriteProxy.Entry<K,V> data,
<any> callback)
Data should be retrieved using the specified load config.
|
void |
setKeyWriter(DataWriter<K,String> keyWriter)
Sets a writer to use for converting key objects into a string to use when
storing values.
|
void |
setValueWriter(DataWriter<V,String> valueWriter)
Sets a writer to use for converting value objects into a string to be
stored.
|
public StorageWriteProxy(boolean session)
session
- true to use session storage, false to use local storagepublic StorageWriteProxy(Storage storage)
storage
- the browser based storagepublic DataWriter<K,String> getKeyWriter()
DataWriter
used for converting key instances
into Stringspublic DataWriter<V,String> getValueWriter()
DataWriter
used for converting value instances
into Stringspublic void load(StorageWriteProxy.Entry<K,V> data, <any> callback)
DataProxy
DataReader
can be used to "process" the raw data.public void setKeyWriter(DataWriter<K,String> keyWriter)
keyWriter
- the key writerpublic void setValueWriter(DataWriter<V,String> valueWriter)
valueWriter
- the data writerCopyright © 2018. All rights reserved.