public abstract class AbstractRequestFactory extends IdFactory implements RequestFactory
JSON_CONTENT_TYPE_UTF8
Constructor and Description |
---|
AbstractRequestFactory() |
Modifier and Type | Method and Description |
---|---|
<P extends EntityProxy> |
find(EntityProxyId<P> proxyId)
Return a request to find a fresh instance of the referenced proxy.
|
protected abstract AutoBeanFactory |
getAutoBeanFactory()
Implementations of EntityProxies are provided by an AutoBeanFactory, which
is itself a generated type.
|
EventBus |
getEventBus()
Returns the event bus this factory's events are posted on, which was set
via
RequestFactory.initialize(com.google.web.bindery.event.shared.EventBus) . |
abstract String |
getFactoryTypeToken()
Returns a type token for the RequestFactory instance, which is used to seed
operation and type token resolution on the server.
|
String |
getHistoryToken(Class<? extends EntityProxy> clazz)
Get a
History compatible token that
represents the given class. |
String |
getHistoryToken(EntityProxyId<?> proxy)
Get a
History compatible token that
represents the given proxy class. |
Class<? extends EntityProxy> |
getProxyClass(String historyToken)
Return the class object which may be used to create new instances of the
type of this token, via
RequestContext.create(java.lang.Class<T>) . |
<T extends EntityProxy> |
getProxyId(String historyToken)
Return the appropriate
EntityProxyId using a string returned from
RequestFactory.getHistoryToken(EntityProxyId) . |
RequestTransport |
getRequestTransport()
Returns the RequestTransport set via
RequestFactory.initialize(com.google.web.bindery.event.shared.EventBus) . |
ProxySerializer |
getSerializer(ProxyStore store)
Returns a ProxySerializer that can encode and decode the various
EntityProxy and ValueProxy types reachable from the RequestFactory.
|
protected boolean |
hasVersionChanged(SimpleProxyId<?> id,
String observedVersion)
Used by
AbstractRequestContext to quiesce update events for objects
that haven't truly changed. |
abstract void |
initialize(EventBus eventBus)
The choice of a default request transport is runtime-specific.
|
void |
initialize(EventBus eventBus,
RequestTransport transport)
Start this request factory with a user-provided transport.
|
allocateId, allocateSyntheticId, asEntityProxy, asValueProxy, getBaseProxyId, getHistoryToken, getId, getId, getId, getTypeFromToken, getTypeToken, isEntityType, isValueType
public <P extends EntityProxy> Request<P> find(EntityProxyId<P> proxyId)
RequestFactory
RequestContext.find(EntityProxyId)
, which supports chained
requests.find
in interface RequestFactory
proxyId
- an EntityProxyId
instance of type PRequest
objectRequestContext.find(EntityProxyId)
public EventBus getEventBus()
RequestFactory
RequestFactory.initialize(com.google.web.bindery.event.shared.EventBus)
.getEventBus
in interface RequestFactory
EventBus
associated with this instancepublic abstract String getFactoryTypeToken()
public String getHistoryToken(Class<? extends EntityProxy> clazz)
RequestFactory
History
compatible token that
represents the given class. It can be processed by
RequestFactory.getProxyClass(String)
getHistoryToken
in interface RequestFactory
clazz
- a Class object for an EntityProxy
subclassHistory
compatible tokenpublic String getHistoryToken(EntityProxyId<?> proxy)
RequestFactory
History
compatible token that
represents the given proxy class. It can be processed by
RequestFactory.getProxyClass(String)
.
The history token returned for an EntityProxyId associated with a newly-created (future) EntityProxy will differ from the token returned by this method after the EntityProxy has been persisted. Once an EntityProxy has been persisted, the return value for this method will always be stable, regardless of when the EntityProxyId was retrieved relative to the persist operation. In other words, the "future" history token returned for an as-yet-unpersisted EntityProxy is only valid for the duration of the RequestFactory's lifespan.
getHistoryToken
in interface RequestFactory
proxy
- an EntityProxyId
instanceHistory
compatible tokenpublic Class<? extends EntityProxy> getProxyClass(String historyToken)
RequestFactory
RequestContext.create(java.lang.Class<T>)
. The token may
represent either a proxy instance (see RequestFactory.getHistoryToken(java.lang.Class<? extends com.google.web.bindery.requestfactory.shared.EntityProxy>)
) or a proxy
class (see RequestFactory.getProxyClass(java.lang.String)
).getProxyClass
in interface RequestFactory
historyToken
- a String tokenEntityProxy
subclasspublic <T extends EntityProxy> EntityProxyId<T> getProxyId(String historyToken)
RequestFactory
EntityProxyId
using a string returned from
RequestFactory.getHistoryToken(EntityProxyId)
.getProxyId
in interface RequestFactory
historyToken
- a String tokenEntityProxyId
public RequestTransport getRequestTransport()
RequestFactory
RequestFactory.initialize(com.google.web.bindery.event.shared.EventBus)
.getRequestTransport
in interface RequestFactory
RequestTransport
associated with this instancepublic ProxySerializer getSerializer(ProxyStore store)
RequestFactory
getSerializer
in interface RequestFactory
store
- a helper object for the ProxySerializer to provide low-level
storage accessDefaultProxyStore
public abstract void initialize(EventBus eventBus)
initialize
in interface RequestFactory
eventBus
- an EventBus
public void initialize(EventBus eventBus, RequestTransport transport)
RequestFactory
initialize
in interface RequestFactory
eventBus
- an EventBus
transport
- a RequestTransport
instanceprotected abstract AutoBeanFactory getAutoBeanFactory()
find(EntityProxyId)
and getSerializer(ProxyStore)
were provided by AbstractRequestContext
, this method could be
removed.protected boolean hasVersionChanged(SimpleProxyId<?> id, String observedVersion)
AbstractRequestContext
to quiesce update events for objects
that haven't truly changed.Copyright © 2016. All rights reserved.