Package com.tangosol.util
Class ConverterCollections.ConverterMapEvent<K,V>
java.lang.Object
java.util.EventObject
com.tangosol.util.MapEvent<K,V>
com.tangosol.net.cache.CacheEvent<K,V>
com.tangosol.util.ConverterCollections.ConverterMapEvent<K,V>
- All Implemented Interfaces:
PortableObject,Serializable
- Direct Known Subclasses:
ConverterCollections.ConverterCacheEvent
- Enclosing class:
ConverterCollections
A ConverterMapEvent views an underlying MapEvent through a set of key and
value Converters. This event may cache converted keys and/or values to
optimize out future conversions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classConverterMapEventBinaryEntry provides both the Map Entry and the BinaryEntry interfaces to the information encapsulated inside the ConverterMapEvent.protected classConverterMapEventEntry provides the Map Entry interface to the information encapsulated inside the ConverterMapEvent.Nested classes/interfaces inherited from class com.tangosol.net.cache.CacheEvent
CacheEvent.TransformationState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BackingMapManagerContextThe BackingMapManagerContext to use for extracting binary values.The Converter to view the underlying MapEvent's key.The Converter to view the underlying MapEvent's value.Cached new entry.Cached old entry.The underlying MapEvent.static final ObjectTag object indicating that a corresponding value has not been converted.Fields inherited from class com.tangosol.net.cache.CacheEvent
EXPIRED, m_nFlags, m_transformState, PRIMING, SYNTHETICFields inherited from class com.tangosol.util.MapEvent
ENTRY_DELETED, ENTRY_INSERTED, ENTRY_UPDATED, m_key, m_nId, m_nPartition, m_nVersion, m_valueNew, m_valueOldFields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionConverterMapEvent(ObservableMap<K, V> map, MapEvent<K, V> event, Converter<K, K> convKey, Converter<V, V> convVal) Construct a ConverterMapEvent.ConverterMapEvent(ObservableMap<K, V> map, MapEvent<K, V> event, Converter<K, K> convKey, Converter<V, V> convVal, BackingMapManagerContext context) Construct a ConverterMapEvent. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemove any cached conversions of the key or values.Get the BackingMapManagerContext if one was provided.Return the Converter used to view the underlying MapEvent's key through.Return the Converter used to view the underlying MapEvent's value through.getKey()Return a key associated with this event.Return the underlying MapEvent.Return a Map Entry that represents the state of the Entry after the change occurred that generated this event.Return a new value associated with this event.Return a Map Entry that represents the state of the Entry before the change occurred that generated this event.Return an old value associated with this event.intReturn the partition this MapEvent represents or -1 if the event source is not partition aware.longReturn the version that represents the change that caused this MapEvent.booleanCheck if the event's key has been converted.booleanCheck if the event's new value has been converted.booleanCheck if the event's old value has been converted.booleanReturn true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.voidSet the cached converted old value associated with this event.voidsetNewValue(V value) Set the cached converted new value associated with this event.voidsetOldValue(V value) Set the cached converted old value associated with this event.Methods inherited from class com.tangosol.net.cache.CacheEvent
getDescription, getTransformationState, isExpired, isPriming, isSynthetic, shouldDispatch, withMethods inherited from class com.tangosol.util.MapEvent
dispatch, dispatch, dispatch, getDescription, getId, getMap, isDelete, isInsert, isUpdate, readExternal, toString, writeExternalMethods inherited from class java.util.EventObject
getSource
-
Field Details
-
NO_VALUE
Tag object indicating that a corresponding value has not been converted. -
m_event
The underlying MapEvent. -
m_convKey
The Converter to view the underlying MapEvent's key. -
m_convVal
The Converter to view the underlying MapEvent's value. -
m_context
The BackingMapManagerContext to use for extracting binary values. -
m_entryOld
Cached old entry. -
m_entryNew
Cached new entry.
-
-
Constructor Details
-
ConverterMapEvent
public ConverterMapEvent(ObservableMap<K, V> map, MapEvent<K, V> event, Converter<K, K> convKey, Converter<V, V> convVal) Construct a ConverterMapEvent.- Parameters:
map- the new event's sourceevent- the underlying MapEventconvKey- the Converter to view the underlying MapEvent's keyconvVal- the Converter to view the underlying MapEvent's values
-
ConverterMapEvent
public ConverterMapEvent(ObservableMap<K, V> map, MapEvent<K, V> event, Converter<K, K> convKey, Converter<V, V> convVal, BackingMapManagerContext context) Construct a ConverterMapEvent.- Parameters:
map- the new event's sourceevent- the underlying MapEventconvKey- the Converter to view the underlying MapEvent's keyconvVal- the Converter to view the underlying MapEvent's valuescontext- the BackingMapManagerContext necessary to emulate the BinaryEntry interface
-
-
Method Details
-
getKey
Return a key associated with this event. -
getOldValue
Return an old value associated with this event.The old value represents a value deleted from or updated in a map. It is always null for "insert" notifications.
- Overrides:
getOldValuein classMapEvent<K,V> - Returns:
- an old value
-
getNewValue
Return a new value associated with this event.The new value represents a new value inserted into or updated in a map. It is always null for "delete" notifications.
- Overrides:
getNewValuein classMapEvent<K,V> - Returns:
- a new value
-
getOldEntry
Return a Map Entry that represents the state of the Entry before the change occurred that generated this event.- Overrides:
getOldEntryin classMapEvent<K,V> - Returns:
- a Map Entry representing the pre-event state of the Entry
-
getNewEntry
Return a Map Entry that represents the state of the Entry after the change occurred that generated this event.- Overrides:
getNewEntryin classMapEvent<K,V> - Returns:
- a Map Entry representing the post-event state of the Entry
-
getPartition
public int getPartition()Description copied from class:MapEventReturn the partition this MapEvent represents or -1 if the event source is not partition aware.- Overrides:
getPartitionin classMapEvent<K,V> - Returns:
- the partition this MapEvent represents or -1 if the event source is not partition aware
-
getVersion
public long getVersion()Description copied from class:MapEventReturn the version that represents the change that caused this MapEvent. The meaning of this version, and therefore causality of versions, is defined by the event source.- Overrides:
getVersionin classMapEvent<K,V> - Returns:
- the version that represents the change that caused this MapEvent
-
isVersionUpdate
public boolean isVersionUpdate()Description copied from class:CacheEventReturn true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.- Overrides:
isVersionUpdatein classCacheEvent<K,V> - Returns:
- true iff this event is caused by a synthetic version update
-
getMapEvent
Return the underlying MapEvent.- Returns:
- the underlying MapEvent
-
getContext
Get the BackingMapManagerContext if one was provided.- Returns:
- the BackingMapManagerContext
-
getConverterKeyUp
Return the Converter used to view the underlying MapEvent's key through.- Returns:
- the Converter from the underlying MapEvent's key
-
getConverterValueUp
Return the Converter used to view the underlying MapEvent's value through.- Returns:
- the Converter from the underlying MapEvent's value
-
setKey
Set the cached converted old value associated with this event.- Parameters:
key- the converted key value
-
setOldValue
Set the cached converted old value associated with this event.- Parameters:
value- the new converted "old" value
-
setNewValue
Set the cached converted new value associated with this event.- Parameters:
value- the new converted "new" value
-
isKeyConverted
public boolean isKeyConverted()Check if the event's key has been converted.- Returns:
- true iff the key has been converted
-
isOldValueConverted
public boolean isOldValueConverted()Check if the event's old value has been converted.- Returns:
- true iff the old value has been converted
-
isNewValueConverted
public boolean isNewValueConverted()Check if the event's new value has been converted.- Returns:
- true iff the new value has been converted
-
clearConverted
public void clearConverted()Remove any cached conversions of the key or values.
-