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.String
encode()
Return a JSON object literal with the contents of the store.Splittable
get(java.lang.String key)
Called byProxySerializer
to retrieve a value previously provided toProxyStore.put(String, Splittable)
.int
nextId()
Returns a non-negative sequence number.void
put(java.lang.String key, Splittable value)
Called byProxySerializer
to store a value.
-
-
-
Constructor Detail
-
DefaultProxyStore
public DefaultProxyStore()
Construct an empty DefaultProxyStore.
-
DefaultProxyStore
public DefaultProxyStore(java.lang.String payload) throws java.lang.IllegalArgumentException
Construct 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:ProxyStore
Called byProxySerializer
to retrieve a value previously provided toProxyStore.put(String, Splittable)
.- Specified by:
get
in interfaceProxyStore
- Parameters:
key
- the key- Returns:
- the associated value or
null
ifkey
is unknown
-
nextId
public int nextId()
Description copied from interface:ProxyStore
Returns 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:
nextId
in interfaceProxyStore
-
put
public void put(java.lang.String key, Splittable value)
Description copied from interface:ProxyStore
Called byProxySerializer
to store a value.- Specified by:
put
in interfaceProxyStore
- Parameters:
key
- a key value that will be passed toProxyStore.get(String)
value
- the data to store- See Also:
Splittable.getPayload()
-
-