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
public static class ConverterCollections.ConverterMapEvent<K,V> extends CacheEvent<K,V>
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classConverterCollections.ConverterMapEvent.ConverterMapEventBinaryEntryConverterMapEventBinaryEntry provides both the Map Entry and the BinaryEntry interfaces to the information encapsulated inside the ConverterMapEvent.protected classConverterCollections.ConverterMapEvent.ConverterMapEventEntryConverterMapEventEntry 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
Fields Modifier and Type Field Description protected BackingMapManagerContextm_contextThe BackingMapManagerContext to use for extracting binary values.protected Converter<K,K>m_convKeyThe Converter to view the underlying MapEvent's key.protected Converter<V,V>m_convValThe Converter to view the underlying MapEvent's value.protected Map.Entry<K,V>m_entryNewCached new entry.protected Map.Entry<K,V>m_entryOldCached old entry.protected MapEvent<K,V>m_eventThe underlying MapEvent.static ObjectNO_VALUETag 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, SYNTHETIC
-
Fields inherited from class com.tangosol.util.MapEvent
ENTRY_DELETED, ENTRY_INSERTED, ENTRY_UPDATED, m_key, m_nId, m_nPartition, m_nVersion, m_valueNew, m_valueOld
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description ConverterMapEvent(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearConverted()Remove any cached conversions of the key or values.BackingMapManagerContextgetContext()Get the BackingMapManagerContext if one was provided.Converter<K,K>getConverterKeyUp()Return the Converter used to view the underlying MapEvent's key through.Converter<V,V>getConverterValueUp()Return the Converter used to view the underlying MapEvent's value through.KgetKey()Return a key associated with this event.MapEvent<K,V>getMapEvent()Return the underlying MapEvent.Map.Entry<K,V>getNewEntry()Return a Map Entry that represents the state of the Entry after the change occurred that generated this event.VgetNewValue()Return a new value associated with this event.Map.Entry<K,V>getOldEntry()Return a Map Entry that represents the state of the Entry before the change occurred that generated this event.VgetOldValue()Return an old value associated with this event.intgetPartition()Return the partition this MapEvent represents or -1 if the event source is not partition aware.longgetVersion()Return the version that represents the change that caused this MapEvent.booleanisKeyConverted()Check if the event's key has been converted.booleanisNewValueConverted()Check if the event's new value has been converted.booleanisOldValueConverted()Check if the event's old value has been converted.booleanisVersionUpdate()Return true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.voidsetKey(K key)Set 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, with
-
Methods inherited from class com.tangosol.util.MapEvent
dispatch, dispatch, dispatch, getDescription, getId, getMap, isDelete, isInsert, isUpdate, readExternal, toString, writeExternal
-
Methods inherited from class java.util.EventObject
getSource
-
-
-
-
Field Detail
-
NO_VALUE
public static final Object NO_VALUE
Tag object indicating that a corresponding value has not been converted.
-
m_convVal
protected Converter<V,V> m_convVal
The Converter to view the underlying MapEvent's value.
-
m_context
protected BackingMapManagerContext m_context
The BackingMapManagerContext to use for extracting binary values.
-
-
Constructor Detail
-
ConverterMapEvent
public ConverterMapEvent(ObservableMap<K,V> map, MapEvent<K,V> event, Converter<K,K> convKey, Converter<V,V> convVal)
Construct a ConverterMapEvent.- Parameters:
event- the underlying MapEventmap- the new event's sourceconvKey- 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:
event- the underlying MapEventmap- the new event's sourceconvKey- 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 Detail
-
getKey
public K getKey()
Return a key associated with this event.
-
getOldValue
public V 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
public V 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
public Map.Entry<K,V> 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
public Map.Entry<K,V> 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
public MapEvent<K,V> getMapEvent()
Return the underlying MapEvent.- Returns:
- the underlying MapEvent
-
getContext
public BackingMapManagerContext getContext()
Get the BackingMapManagerContext if one was provided.- Returns:
- the BackingMapManagerContext
-
getConverterKeyUp
public Converter<K,K> getConverterKeyUp()
Return the Converter used to view the underlying MapEvent's key through.- Returns:
- the Converter from the underlying MapEvent's key
-
getConverterValueUp
public Converter<V,V> getConverterValueUp()
Return the Converter used to view the underlying MapEvent's value through.- Returns:
- the Converter from the underlying MapEvent's value
-
setKey
public void setKey(K key)
Set the cached converted old value associated with this event.- Parameters:
key- the converted key value
-
setOldValue
public void setOldValue(V value)
Set the cached converted old value associated with this event.- Parameters:
value- the new converted "old" value
-
setNewValue
public void setNewValue(V value)
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.
-
-