com.google.web.bindery.requestfactory.shared

## 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 and Description
`DefaultProxyStore()` Construct an empty DefaultProxyStore.
`DefaultProxyStore(java.lang.String payload)` Construct a DefaultProxyStore using the a value returned from `encode()`.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.String` `encode()` Return a JSON object literal with the contents of the store.
`Splittable` `get(java.lang.String key)` Called by `ProxySerializer` to retrieve a value previously provided to `ProxyStore.put(String, Splittable)`.
`int` `nextId()` Returns a non-negative sequence number.
`void` `put(java.lang.String key, Splittable value)` Called by `ProxySerializer` to store a value.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 from `encode()`.

Parameters:
  `payload` - a String previously returned from `encode()`
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 by `ProxySerializer` to retrieve a value previously provided to `ProxyStore.put(String, Splittable)`.

Specified by:
  `get` in interface `ProxyStore`
Parameters:
  `key` - the key
Returns:
  the associated value or `null` if `key` 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 interface `ProxyStore`

#### put

    public void put(java.lang.String key,
                    Splittable value)

Description copied from interface: `ProxyStore`
Called by `ProxySerializer` to store a value.

Specified by:
  `put` in interface `ProxyStore`
Parameters:
  `key` - a key value that will be passed to `ProxyStore.get(String)`
  `value` - the data to store
See Also:
  `Splittable.getPayload()`