P
- the type of the proxypublic class EntityProxyChange<P extends EntityProxy> extends Event<EntityProxyChange.Handler<P>>
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)
.
Modifier and Type | Class and Description |
---|---|
static interface |
EntityProxyChange.Handler<P extends EntityProxy>
Implemented by methods that handle EntityProxyChange events.
|
Event.Type<H>
Constructor and Description |
---|
EntityProxyChange(P proxy,
WriteOperation writeOperation)
Constructs an EntityProxyChange object.
|
Modifier and Type | Method and Description |
---|---|
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> |
registerForProxyType(EventBus eventBus,
java.lang.Class<P> proxyType,
EntityProxyChange.Handler<P> handler)
Register a handler for a EntityProxyChange events for a particular proxy
class.
|
getSource, setSource, toDebugString, toString
public EntityProxyChange(P proxy, WriteOperation writeOperation)
proxy
- an EntityProxy
instance of type PwriteOperation
- a WriteOperation
instancepublic static <P extends EntityProxy> HandlerRegistration registerForProxyType(EventBus eventBus, java.lang.Class<P> proxyType, EntityProxyChange.Handler<P> handler)
eventBus
- the EventBus
proxyType
- a Class instance of type Phandler
- an EntityProxyChange.Handler
instance of type PEntityProxy
instancepublic Event.Type<EntityProxyChange.Handler<P>> getAssociatedType()
getAssociatedType
in class Event<EntityProxyChange.Handler<P extends EntityProxy>>
Type
of type Handler<P>public EntityProxyId<P> getProxyId()
EntityProxyId
<P>public WriteOperation getWriteOperation()
WriteOperation
associated with this instance.WriteOperation
instanceprotected void dispatch(EntityProxyChange.Handler<P> handler)
Event
EventBus.fireEvent(Event)
or
EventBus.fireEventFromSource(Event, Object)
.dispatch
in class Event<EntityProxyChange.Handler<P extends EntityProxy>>
handler
- handlerEventBus.dispatchEvent(Event, Object)