public interface ChangeRecord<K,V>
ChangeRecord
s are typically provided to EventInterceptor
s as part of a FederatedChangeEvent
for the purpose of inspecting and possibly modifying an entry prior to it being committed.
EventInterceptor
s may choose to reject the change
or change the value
. When no change is specified the modified value is committed.
Any updates to a ChangeRecord
will overwrite the modified Entry and thus the updated value when the change is committed.
When ChangeRecord
is for a local participant, the original and local entry will be the same.
Modifier and Type | Interface and Description |
---|---|
static interface |
ChangeRecord.Entry<K,V>
Represents the key, value and name of the
Participant from which the entry originated. |
Modifier and Type | Method and Description |
---|---|
ChangeRecord<Binary,Binary> |
getBinaryChangeRecord()
Obtain a Binary representation of the {@link ChangeRecord}, with the key and values in {@link Binary} format.
|
FederatedChangeEvent.Type |
getEventType()
The type of the FederatedChangeEvent.
|
K |
getKey()
Obtain the key of the changed
ChangeRecord.Entry . |
ChangeRecord.Entry<K,V> |
getLocalEntry()
Obtains a representation of
ChangeRecord.Entry as it appears in the local participant. |
ChangeRecord.Entry<K,V> |
getModifiedEntry()
Obtain a representation of the modified
ChangeRecord.Entry . |
ChangeRecord.Entry<K,V> |
getOriginalEntry()
Obtain a representation of the
ChangeRecord.Entry prior to any changes occurring. |
boolean |
isDeleted()
Determine if the modified entry in the ChangeRecord was deleted.
|
void |
rejectChange()
Signal that the modified
ChangeRecord.Entry should not be applied. |
void |
setValue(V newValue)
Update the modified
ChangeRecord.Entry value. |
<T> void |
update(ValueUpdater<V,T> updater, T oValue)
Update the modified Entry's value using the given
ValueUpdater . |
K getKey()
ChangeRecord.Entry
.ChangeRecord.Entry<K,V> getModifiedEntry()
ChangeRecord.Entry
.
This ChangeRecord.Entry
will be used to modify the associated ChangeRecord.Entry
in the destination participant.
ChangeRecord.Entry<K,V> getOriginalEntry()
ChangeRecord.Entry
prior to any changes occurring.
This is typically a representation of the ChangeRecord.Entry
at the source participant prior to a change occurring.
ChangeRecord.Entry<K,V> getLocalEntry()
ChangeRecord.Entry
as it appears in the local participant.FederatedChangeEvent.Type getEventType()
void setValue(V newValue)
ChangeRecord.Entry
value.
It can potentially cause the change to be propagated back to the source participant. So care must be taken to avoid any recursive ping-pong cycles.
newValue
- new value for the modified entry<T> void update(ValueUpdater<V,T> updater, T oValue)
ValueUpdater
.updater
- a ValueUpdater used to modify the Entry's valueoValue
- the new value for this Entryvoid rejectChange()
ChangeRecord.Entry
should not be applied. The local ChangeRecord.Entry
should remain unchanged.boolean isDeleted()
ChangeRecord<Binary,Binary> getBinaryChangeRecord()