Interface RequestFactory
- All Known Implementing Classes:
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestFactory
,FakeRequestFactory
,InProcessRequestFactory
Limitations on the transferrability of types.
RequestFactory currently supports the transfer of basic value types, entity
types, and collections, with limitations. The basic value types supported are
String
, Enum
, Boolean
, Character
, subtypes of
Number
, and Date
. Any value type not included in
this list may not be declared in the type signature of a service method, or
EntityProxy
. Collection
types supported are
List
and Set
with the restriction that a
collection must be homogeneous and only hold one type of value.
Polymorphism is not supported at this time. RequestFactory encoding and
decoding requires exact knowledge of the concrete type. If a method declares
a given type T
as a parameter or return type, only
T
's transferrable properties will be sent over the wire if it is
a proxy, even if the underlying domain value contains extra fields, in
effect, treating it as an instance of the supertype. Returning abstract
supertypes of value types is not supported (e.g. Object, Enum, Number).
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription<P extends EntityProxy>
Request<P> find
(EntityProxyId<P> proxyId) Return a request to find a fresh instance of the referenced proxy.Returns the event bus this factory's events are posted on, which was set viainitialize(com.google.web.bindery.event.shared.EventBus)
.getHistoryToken
(EntityProxyId<?> proxy) Get aHistory
compatible token that represents the given proxy class.getHistoryToken
(Class<? extends EntityProxy> clazz) Get aHistory
compatible token that represents the given 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, viaRequestContext.create(java.lang.Class<T>)
.<T extends EntityProxy>
EntityProxyId<T> getProxyId
(String historyToken) Return the appropriateEntityProxyId
using a string returned fromgetHistoryToken(EntityProxyId)
.Returns the RequestTransport set viainitialize(com.google.web.bindery.event.shared.EventBus)
.getSerializer
(ProxyStore store) Returns a ProxySerializer that can encode and decode the various EntityProxy and ValueProxy types reachable from the RequestFactory.void
initialize
(EventBus eventBus) Start this request factory with aDefaultRequestTransport
.void
initialize
(EventBus eventBus, RequestTransport transport) Start this request factory with a user-provided transport.
-
Field Details
-
JSON_CONTENT_TYPE_UTF8
The JSON content type String.- See Also:
-
-
Method Details
-
getEventBus
EventBus getEventBus()Returns the event bus this factory's events are posted on, which was set viainitialize(com.google.web.bindery.event.shared.EventBus)
.- Returns:
- the
EventBus
associated with this instance
-
getHistoryToken
Get aHistory
compatible token that represents the given class. It can be processed bygetProxyClass(String)
- Parameters:
clazz
- a Class object for anEntityProxy
subclass- Returns:
- a
History
compatible token
-
getProxyClass
Return the class object which may be used to create new instances of the type of this token, viaRequestContext.create(java.lang.Class<T>)
. The token may represent either a proxy instance (seegetHistoryToken(java.lang.Class<? extends com.google.web.bindery.requestfactory.shared.EntityProxy>)
) or a proxy class (seegetProxyClass(java.lang.String)
).- Parameters:
historyToken
- a String token- Returns:
- a Class object for an
EntityProxy
subclass
-
getProxyId
Return the appropriateEntityProxyId
using a string returned fromgetHistoryToken(EntityProxyId)
.- Parameters:
historyToken
- a String token- Returns:
- an
EntityProxyId
-
getRequestTransport
RequestTransport getRequestTransport()Returns the RequestTransport set viainitialize(com.google.web.bindery.event.shared.EventBus)
.- Returns:
- the
RequestTransport
associated with this instance