GWT 2.1.0

com.google.gwt.requestfactory.shared
Interface RequestContext

All Known Subinterfaces:
LoggingRequest, UserInformationRequest

public interface RequestContext

The base interface for RequestFactory service endpoints.


Method Summary
<T extends EntityProxy>
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 EntityProxy>
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 EntityProxy> 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 a persist does happen, a CREATE event will be posted including the EntityProxyId of this proxy.


edit

<T extends EntityProxy> 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.


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.

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());
 


GWT 2.1.0