GWT Docs have this to say:
Local Storage is String Storage
HTML5 local storage saves data in
string form as key-value pairs. If the data you wish to save is not
string data, you are responsible for conversion to and from string
when using LocalStorage. For proxy classes used with the GWT
RequestFactory, you can use RequestFactory#getSerializer() to do
string serializing. For non-proxy objects, you could use JSON
stringify and parse.
EDIT:
RequestFactory#getSerializer()
returns an implementation of ProxySerializer
. But
ProxySerializer Serializes graphs of EntityProxy objects. A
ProxySerializer is associated with an instance of a ProxyStore when it
is created via RequestFactory.getSerializer(ProxyStore).
So you cannot use it to serialize arbitrary objects. Only EntityProxy
objects can be serialized this way. GWT documentation does not mention any method for doing such serialization for non-EntityProxy
objects, so I think it is safe to assume that there is no ready-made solution for doing this so far. For non-EntityProxy
objects, GWT docs (quoted above) recommend using JSON serialization.