GWT 2.3.0

com.google.web.bindery.requestfactory.shared
Interface RequestContext

All Known Subinterfaces:
LoggingRequest

public interface RequestContext

The base interface for RequestFactory service endpoints.


Method Summary
<T extends BaseProxy>
T
create(java.lang.Class<T> clazz)
          Returns a new mutable proxy that this request can carry to the server, perhaps to be persisted.
<T extends BaseProxy>
T
edit(T object)
          Returns a mutable version of the proxy, whose mutations will accumulate in this context.
 void fire()
          Send the accumulated changes and method invocations associated with the RequestContext.
 void fire(Receiver<java.lang.Void> receiver)
          For receiving errors or validation failures only.
 boolean isChanged()
          Returns true if any changes have been made to proxies mutable under this context.
 

Method Detail

create

<T extends BaseProxy> T create(java.lang.Class<T> clazz)
Returns a new mutable proxy that this request can carry to the server, perhaps to be persisted. If the object is succesfully persisted, a PERSIST event will be posted including the EntityProxyId of this proxy.

Parameters:
clazz - a Class object of type T
Returns:
an BaseProxy instance of type T

edit

<T extends BaseProxy> T edit(T object)
Returns a mutable version of the proxy, whose mutations will accumulate in this context. Proxies reached via getters on this mutable proxy will also be mutable.

Parameters:
object - an instance of type T
Returns:
an EntityProxy or ValueProxy instance of type T

fire

void fire()
Send the accumulated changes and method invocations associated with the RequestContext.

If Request.to(Receiver) has not been called, this method will install a default receiver that will throw a RuntimeException if there is a server failure.


fire

void fire(Receiver<java.lang.Void> receiver)
For receiving errors or validation failures only.

Parameters:
receiver - a Receiver instance
Throws:
java.lang.IllegalArgumentException - if receiver is null

isChanged

boolean isChanged()
Returns true if any changes have been made to proxies mutable under this context. Note that vacuous changes — e.g. foo.setName(foo.getName() — will not trip the changed flag. Similarly, "unmaking" a change will clear the isChanged flag
 String name = bar.getName();
 bar.setName("something else");
 assertTrue(context.isChanged());
 bar.setName(name);
 assertFalse(context.isChanged());
 

Returns:
true if any changes have been made

GWT 2.3.0