com.google.web.bindery.requestfactory.shared

## Class EntityProxyChange<P extends EntityProxy>

- java.lang.Object
- - com.google.web.bindery.event.shared.Event<EntityProxyChange.Handler<P>>
  - - com.google.web.bindery.requestfactory.shared.EntityProxyChange<P>

Type Parameters:
  `P` - the type of the proxy

    public class EntityProxyChange<P extends EntityProxy>
    extends Event<EntityProxyChange.Handler<P>>

Event posted by a `RequestFactory` when changes to an entity are detected. Provides a `WriteOperation` value describing the change, and the `EntityProxyId` of the entity in question.

EntityProxyChange events are posted with the relevant EntityProxy Class as their source, allowing handlers to register for changes only of the type they care about via `registerForProxyType(EventBus, Class, Handler)`.

See Also:
  `RequestFactory.initialize(EventBus)`, `RequestFactory.find(EntityProxyId)`

### Nested Class Summary

Nested Classes
`static interface` `EntityProxyChange.Handler<P extends EntityProxy>` Implemented by methods that handle EntityProxyChange events.

### Nested classes/interfaces inherited from class com.google.web.bindery.event.shared.Event

`Event.Type<H>`

### Constructor Summary

Constructors
Constructor and Description
`EntityProxyChange(P proxy, WriteOperation writeOperation)` Constructs an EntityProxyChange object.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `dispatch(EntityProxyChange.Handler<P> handler)` Implemented by subclasses to to invoke their handlers in a type safe manner.
`Event.Type<EntityProxyChange.Handler<P>>` `getAssociatedType()` Returns the type associated with this instance.
`EntityProxyId<P>` `getProxyId()` Returns an unpopulated copy of the changed proxy — all properties are undefined except its id.
`WriteOperation` `getWriteOperation()` Returns the `WriteOperation` associated with this instance.
`static <P extends EntityProxy> HandlerRegistration` `registerForProxyType(EventBus eventBus, java.lang.Class<P> proxyType, EntityProxyChange.Handler<P> handler)` Register a handler for a EntityProxyChange events for a particular proxy class.

### Methods inherited from class com.google.web.bindery.event.shared.Event

`getSource, setSource, toDebugString, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### EntityProxyChange

    public EntityProxyChange(P proxy,
                             WriteOperation writeOperation)

Constructs an EntityProxyChange object.

Parameters:
  `proxy` - an `EntityProxy` instance of type P
  `writeOperation` - a `WriteOperation` instance

### Method Detail

#### registerForProxyType

    public static <P extends EntityProxy> HandlerRegistration registerForProxyType(EventBus eventBus,
                                                                                   java.lang.Class<P> proxyType,
                                                                                   EntityProxyChange.Handler<P> handler)

Register a handler for a EntityProxyChange events for a particular proxy class.

Parameters:
  `eventBus` - the `EventBus`
  `proxyType` - a Class instance of type P
  `handler` - an `EntityProxyChange.Handler` instance of type P
Returns:
  an `EntityProxy` instance

#### getAssociatedType

    public Event.Type<EntityProxyChange.Handler<P>> getAssociatedType()

Returns the type associated with this instance.

Specified by:
  `getAssociatedType` in class `Event<EntityProxyChange.Handler<P extends EntityProxy>>`
Returns:
  an instance of `Type` of type Handler<P>

#### getProxyId

    public EntityProxyId<P> getProxyId()

Returns an unpopulated copy of the changed proxy — all properties are undefined except its id.

Returns:
  an instance of `EntityProxyId`<P>

#### getWriteOperation

    public WriteOperation getWriteOperation()

Returns the `WriteOperation` associated with this instance.

Returns:
  a `WriteOperation` instance

#### dispatch

    protected void dispatch(EntityProxyChange.Handler<P> handler)

Description copied from class: `Event`
Implemented by subclasses to to invoke their handlers in a type safe manner. Intended to be called by `EventBus.fireEvent(Event)` or `EventBus.fireEventFromSource(Event, Object)`.

Specified by:
  `dispatch` in class `Event<EntityProxyChange.Handler<P extends EntityProxy>>`
Parameters:
  `handler` - handler
See Also:
  `EventBus.dispatchEvent(Event, Object)`