Class CacheEventFilter<K,V>

Type Parameters:
K - the type of the cache entry keys
V - the type of the cache entry values
All Implemented Interfaces:
ExternalizableLite, PortableObject, Filter<MapEvent<K,V>>, Serializable

public class CacheEventFilter<K,V> extends MapEventFilter<K,V>
An extension of the MapEventFilter which allows selection of client driven (natural) events, cache internal (synthetic) events, or both.
Since:
Coherence 3.7.1.9
Author:
sw 2013.04.04
See Also:
  • Field Details

    • E_SYNTHETIC

      public static final int E_SYNTHETIC
      Bitmask to select synthetic events.
      See Also:
    • E_NATURAL

      public static final int E_NATURAL
      Bitmask to select natural events.
      See Also:
    • m_nMaskSynthetic

      protected int m_nMaskSynthetic
      Bitmask that selects whether to include synthetic, natural, or all events.
  • Constructor Details

    • CacheEventFilter

      public CacheEventFilter()
      Default constructor (necessary for the ExternalizableLite interface).
    • CacheEventFilter

      public CacheEventFilter(int nMask, int nMaskSynthetic)
      Construct a CacheEventFilter that evaluates MapEvent objects based on the specified combination of event types.

      Using this constructor is equivalent to: new CacheEventFilter(nMask, null, nMaskSynthetic);

      Parameters:
      nMask - any combination of E_INSERTED, E_UPDATED and E_DELETED, E_UPDATED_ENTERED, E_UPDATED_WITHIN, E_UPDATED_LEFT
      nMaskSynthetic - any combination of E_SYNTHETIC and E_NATURAL
    • CacheEventFilter

      public CacheEventFilter(Filter<V> filter, int nMaskSynthetic)
      Construct a CacheEventFilter that evaluates MapEvent objects that would affect the results of a keySet filter issued by a previous call to QueryMap.keySet(com.tangosol.util.Filter). It is possible to easily implement continuous query functionality.

      Using this constructor is equivalent to: new CacheEventFilter(E_KEYSET, filter, nMaskSynthetic);

      Parameters:
      filter - the filter passed previously to a keySet() query method
      nMaskSynthetic - any combination of E_SYNTHETIC and E_NATURAL
    • CacheEventFilter

      public CacheEventFilter(int nMask, Filter<V> filter, int nMaskSynthetic)
      Construct a CacheEventFilter that evaluates MapEvent objects based on the specified combination of event types.
      Parameters:
      nMask - combination of any of the E_* values
      filter - (optional) the filter used for evaluating event values
      nMaskSynthetic - any combination of E_SYNTHETIC and E_NATURAL
  • Method Details

    • evaluate

      public boolean evaluate(MapEvent<K,V> o)
      Apply the test to the input argument.
      Specified by:
      evaluate in interface Filter<K>
      Overrides:
      evaluate in class MapEventFilter<K,V>
      Parameters:
      o - the input argument to evaluate
      Returns:
      true if the input argument matches the filter, otherwise false
    • equals

      public boolean equals(Object o)
      Compare the CacheEventFilter with another object to determine equality.
      Overrides:
      equals in class MapEventFilter<K,V>
      Returns:
      true iff this CacheEventFilter and the passed object are equivalent filters
    • hashCode

      public int hashCode()
      Determine a hash value for the CacheEventFilter object according to the general Object.hashCode() contract.
      Overrides:
      hashCode in class MapEventFilter<K,V>
      Returns:
      an integer hash value for this MapEventFilter object
    • getDescription

      protected String getDescription()
      Get the filter's description.
      Overrides:
      getDescription in class MapEventFilter<K,V>
      Returns:
      this filter's description
    • readExternal

      public void readExternal(DataInput in) throws IOException
      Restore the contents of this object by loading the object's state from the passed DataInput object.
      Specified by:
      readExternal in interface ExternalizableLite
      Overrides:
      readExternal in class MapEventFilter<K,V>
      Parameters:
      in - the DataInput stream to read data from in order to restore the state of this object
      Throws:
      IOException - if an I/O exception occurs
    • writeExternal

      public void writeExternal(DataOutput out) throws IOException
      Save the contents of this object by storing the object's state into the passed DataOutput object.
      Specified by:
      writeExternal in interface ExternalizableLite
      Overrides:
      writeExternal in class MapEventFilter<K,V>
      Parameters:
      out - the DataOutput stream to write the state of this object to
      Throws:
      IOException - if an I/O exception occurs
    • readExternal

      public void readExternal(PofReader in) throws IOException
      Restore the contents of a user type instance by reading its state using the specified PofReader object.
      Specified by:
      readExternal in interface PortableObject
      Overrides:
      readExternal in class MapEventFilter<K,V>
      Parameters:
      in - the PofReader from which to read the object's state
      Throws:
      IOException - if an I/O error occurs
    • writeExternal

      public void writeExternal(PofWriter out) throws IOException
      Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
      Specified by:
      writeExternal in interface PortableObject
      Overrides:
      writeExternal in class MapEventFilter<K,V>
      Parameters:
      out - the PofWriter to which to write the object's state
      Throws:
      IOException - if an I/O error occurs