Class DefaultProxyStore
- java.lang.Object
-
- com.google.web.bindery.requestfactory.shared.DefaultProxyStore
-
- All Implemented Interfaces:
ProxyStore
public class DefaultProxyStore extends java.lang.Object implements ProxyStore
An in-memory ProxyStore store that can encode its state as a JSON object literal.
-
-
Constructor Summary
Constructors Constructor Description DefaultProxyStore()Construct an empty DefaultProxyStore.DefaultProxyStore(java.lang.String payload)Construct a DefaultProxyStore using the a value returned fromencode().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringencode()Return a JSON object literal with the contents of the store.Splittableget(java.lang.String key)Called byProxySerializerto retrieve a value previously provided toProxyStore.put(String, Splittable).intnextId()Returns a non-negative sequence number.voidput(java.lang.String key, Splittable value)Called byProxySerializerto store a value.
-
-
-
Constructor Detail
-
DefaultProxyStore
public DefaultProxyStore()
Construct an empty DefaultProxyStore.
-
DefaultProxyStore
public DefaultProxyStore(java.lang.String payload) throws java.lang.IllegalArgumentExceptionConstruct a DefaultProxyStore using the a value returned fromencode().- Parameters:
payload- a String previously returned fromencode()- Throws:
java.lang.IllegalArgumentException- if the payload cannot be parsed
-
-
Method Detail
-
encode
public java.lang.String encode()
Return a JSON object literal with the contents of the store.
-
get
public Splittable get(java.lang.String key)
Description copied from interface:ProxyStoreCalled byProxySerializerto retrieve a value previously provided toProxyStore.put(String, Splittable).- Specified by:
getin interfaceProxyStore- Parameters:
key- the key- Returns:
- the associated value or
nullifkeyis unknown
-
nextId
public int nextId()
Description copied from interface:ProxyStoreReturns a non-negative sequence number. The actual sequence of values returned by this method is unimportant, as long as the numbers in the sequence are unique.- Specified by:
nextIdin interfaceProxyStore
-
put
public void put(java.lang.String key, Splittable value)Description copied from interface:ProxyStoreCalled byProxySerializerto store a value.- Specified by:
putin interfaceProxyStore- Parameters:
key- a key value that will be passed toProxyStore.get(String)value- the data to store- See Also:
Splittable.getPayload()
-
-