public class

AbstractRequestContext

extends Object
implements RequestContext EntityCodex.EntitySource
java.lang.Object
   ↳ com.google.gwt.requestfactory.shared.impl.AbstractRequestContext

Class Overview

Base implementations for RequestContext services.

Summary

Protected Constructors
AbstractRequestContext(AbstractRequestFactory factory)
Public Methods
<T extends BaseProxy> T create(Class<T> clazz)
Create a new object, with an ephemeral id.
<T extends BaseProxy> T edit(T object)
Returns a mutable version of the proxy, whose mutations will accumulate in this context.
<T extends BaseProxy> T editProxy(T object)
Take ownership of a proxy instance and make it editable.
void fire(Receiver<Void> receiver)
For receiving errors or validation failures only.
void fire()
Make sure there's a default receiver so errors don't get dropped.
<Q extends BaseProxy> AutoBean<Q> getBeanForPayload(Splittable serializedProxyId)
EntityCodex support.
AbstractRequestFactory getRequestFactory()
Splittable getSerializedProxyId(SimpleProxyId<?> stableId)
EntityCodex support.
boolean isChanged()
Returns true if any changes have been made to proxies mutable under this context.
boolean isEntityType(Class<?> clazz)
EntityCodex support.
boolean isLocked()
boolean isValueType(Class<?> clazz)
EntityCodex support.
Protected Methods
void addInvocation(AbstractRequest<?> request)
Called by generated subclasses to enqueue a method invocation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gwt.requestfactory.shared.RequestContext
From interface com.google.gwt.requestfactory.shared.impl.EntityCodex.EntitySource

Protected Constructors

protected AbstractRequestContext (AbstractRequestFactory factory)

Public Methods

public T create (Class<T> clazz)

Create a new object, with an ephemeral id.

Parameters
clazz a Class object of type T
Returns

public 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

public T editProxy (T object)

Take ownership of a proxy instance and make it editable.

public void fire (Receiver<Void> receiver)

For receiving errors or validation failures only.

Parameters
receiver a Receiver instance

public void fire ()

Make sure there's a default receiver so errors don't get dropped. This behavior should be revisited when chaining is supported, depending on whether or not chained invocations can fail independently.

public AutoBean<Q> getBeanForPayload (Splittable serializedProxyId)

EntityCodex support.

public AbstractRequestFactory getRequestFactory ()

public Splittable getSerializedProxyId (SimpleProxyId<?> stableId)

EntityCodex support.

public 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

public boolean isEntityType (Class<?> clazz)

EntityCodex support.

public boolean isLocked ()

public boolean isValueType (Class<?> clazz)

EntityCodex support.

Protected Methods

protected void addInvocation (AbstractRequest<?> request)

Called by generated subclasses to enqueue a method invocation.