Interface ResourceEventHandler<T>
- Type Parameters:
T- resource
public interface ResourceEventHandler<T>
ResourceEventHandler can handle notifications for events that
happen to a resource. The events are information only, so you can't
return an error.
-
Method Summary
Modifier and Type Method Description voidonAdd(T obj)Called when an object is added.voidonDelete(T obj, boolean deletedFinalStateUnknown)Gets the final state of the item if it is known, otherwise it would get an object of the DeletedFinalStateUnknown.voidonUpdate(T oldObj, T newObj)Called when an object is modified.
-
Method Details
-
onAdd
Called when an object is added.- Parameters:
obj- object
-
onUpdate
Called when an object is modified. Note that oldObj is the last known state of the object -- it is possible that several changes were combined together, so you can't use this to see every single change. It is also called when a re-list happens, and it will get called even if nothing changes. This is useful for periodically evaluating or syncing something.- Parameters:
oldObj- old objectnewObj- new object
-
onDelete
Gets the final state of the item if it is known, otherwise it would get an object of the DeletedFinalStateUnknown. This can happen if the watch is closed and misses the delete event and we don't notice the deletion until the subsequent re-list.- Parameters:
obj- object to deletedeletedFinalStateUnknown- get final state of item if it is known or not.
-