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:
  • Field Details

    • NO_VALUE

      public static final Object NO_VALUE
      Tag object indicating that a corresponding value has not been converted.
    • m_event

      protected MapEvent<K,V> m_event
      The underlying MapEvent.
    • m_convKey

      protected Converter<K,K> m_convKey
      The Converter to view the underlying MapEvent's key.
    • 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.
    • m_entryOld

      protected Map.Entry<K,V> m_entryOld
      Cached old entry.
    • m_entryNew

      protected Map.Entry<K,V> 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 source
      event - the underlying MapEvent
      convKey - the Converter to view the underlying MapEvent's key
      convVal - 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 source
      event - the underlying MapEvent
      convKey - the Converter to view the underlying MapEvent's key
      convVal - the Converter to view the underlying MapEvent's values
      context - the BackingMapManagerContext necessary to emulate the BinaryEntry interface
  • Method Details

    • getKey

      public K getKey()
      Return a key associated with this event.
      Overrides:
      getKey in class MapEvent<K,V>
      Returns:
      a key
    • 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:
      getOldValue in class MapEvent<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:
      getNewValue in class MapEvent<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:
      getOldEntry in class MapEvent<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:
      getNewEntry in class MapEvent<K,V>
      Returns:
      a Map Entry representing the post-event state of the Entry
    • getPartition

      public int getPartition()
      Description copied from class: MapEvent
      Return the partition this MapEvent represents or -1 if the event source is not partition aware.
      Overrides:
      getPartition in class MapEvent<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: MapEvent
      Return 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:
      getVersion in class MapEvent<K,V>
      Returns:
      the version that represents the change that caused this MapEvent
    • isVersionUpdate

      public boolean isVersionUpdate()
      Description copied from class: CacheEvent
      Return true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.
      Overrides:
      isVersionUpdate in class CacheEvent<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.