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 aRequestFactory
when changes to an entity are detected. Provides aWriteOperation
value describing the change, and theEntityProxyId
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)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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 Description EntityProxyChange(P proxy, WriteOperation writeOperation)
Constructs an EntityProxyChange object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 theWriteOperation
associated with this instance.static <P extends EntityProxy>
HandlerRegistrationregisterForProxyType(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
-
-
-
-
Constructor Detail
-
EntityProxyChange
public EntityProxyChange(P proxy, WriteOperation writeOperation)
Constructs an EntityProxyChange object.- Parameters:
proxy
- anEntityProxy
instance of type PwriteOperation
- aWriteOperation
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
- theEventBus
proxyType
- a Class instance of type Phandler
- anEntityProxyChange.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 classEvent<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 theWriteOperation
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 byEventBus.fireEvent(Event)
orEventBus.fireEventFromSource(Event, Object)
.- Specified by:
dispatch
in classEvent<EntityProxyChange.Handler<P extends EntityProxy>>
- Parameters:
handler
- handler- See Also:
EventBus.dispatchEvent(Event, Object)
-
-