public interface MapInterceptor extends Serializable
MapInterceptors are chained when added to the map, which means that when an interceptor is added on node initialization, it could be added twice. To prevent this, make sure to implement the hashCode method to return the same value for every instance of the class.
Serialized instances of this interface are used in client-member communication, so changing an implementation's binary format will render it incompatible with its previous versions.
Modifier and Type | Method and Description |
---|---|
void |
afterGet(Object value)
Called after the get(...) operation is completed.
|
void |
afterPut(Object value)
Called after the put(...) operation is completed.
|
void |
afterRemove(Object oldValue)
Called after the remove(...) operation is completed.
|
Object |
interceptGet(Object value)
Intercepts the get operation before returning value.
|
Object |
interceptPut(Object oldValue,
Object newValue)
Intercepts the put operation before modifying the map data.
|
Object |
interceptRemove(Object removedValue)
Intercepts the remove operation before removing the data.
|
Object interceptGet(Object value)
Returns another object to change the return value of get(...) operations.
Returning null
will cause the get(...) operation to return the
original value, so return null
if you do not want to change
anything.
Mutations made to the value do not affect the stored value. They do affect the returned value.
value
- the original value to be returned as the result of get(...)
operationvoid afterGet(Object value)
Mutations made to value do not affect the stored value.
value
- the value returned as the result of the get(...) operationObject interceptPut(Object oldValue, Object newValue)
Returns the object to be put into the map. Returning null
will
cause the put(...) operation to operate as expected, namely no
interception. Throwing an exception will cancel the put operation.
oldValue
- the value currently in mapnewValue
- the new value to be put into the mapvoid afterPut(Object value)
value
- the value returned as the result of the put(...) operationObject interceptRemove(Object removedValue)
Returns the object to be returned as the result of the remove operation. Throwing an exception will cancel the remove operation.
removedValue
- the existing value to be removedvoid afterRemove(Object oldValue)
oldValue
- the value returned as the result of the remove(...)
operationCopyright © 2022 Hazelcast, Inc.. All Rights Reserved.