Skip navigation links

Oracle® Coherence Java API Reference
v3.5

E14977-01


com.tangosol.util
Class MapEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.tangosol.util.MapEvent

All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CacheEvent, ConverterCollections.ConverterMapEvent

public class MapEvent
extends java.util.EventObject

An event which indicates that the content of a map has changed:

A MapEvent object is sent as an argument to the MapListener interface methods. Null values may be provided for the old and the new values.

Author:
gg 2002.02.11

Field Summary
static int ENTRY_DELETED
          This event indicates that an entry has been removed from the map.
static int ENTRY_INSERTED
          This event indicates that an entry has been added to the map.
static int ENTRY_UPDATED
          This event indicates that an entry has been updated in the map.
protected  int m_nId
          The event's id.
protected  java.lang.Object m_oKey
          A key.
protected  java.lang.Object m_oValueNew
          A new value.
protected  java.lang.Object m_oValueOld
          A previous value.

 

Fields inherited from class java.util.EventObject
source

 

Constructor Summary
MapEvent(ObservableMap map, int nId, java.lang.Object oKey, java.lang.Object oValueOld, java.lang.Object oValueNew)
          Constructs a new MapEvent.

 

Method Summary
 void dispatch(Listeners listeners)
          Dispatch this event to the specified listeners collection.
 void dispatch(Listeners listeners, boolean fStrict)
          Dispatch this event to the specified listeners collection.
 void dispatch(MapListener listener)
          Dispatch this event to the specified MapListener.
protected  java.lang.String getDescription()
          Get the event's description.
static java.lang.String getDescription(int nId)
          Convert an event ID into a human-readable string.
 int getId()
          Return this event's id.
 java.lang.Object getKey()
          Return a key associated with this event.
 ObservableMap getMap()
          Return an ObservableMap object on which this event has actually occured.
 java.lang.Object getNewValue()
          Return a new value associated with this event.
 java.lang.Object getOldValue()
          Return an old value associated with this event.
 java.lang.String toString()
          Return a String representation of this MapEvent object.

 

Methods inherited from class java.util.EventObject
getSource

 

Field Detail

ENTRY_INSERTED

public static final int ENTRY_INSERTED
This event indicates that an entry has been added to the map.
See Also:
Constant Field Values

ENTRY_UPDATED

public static final int ENTRY_UPDATED
This event indicates that an entry has been updated in the map.
See Also:
Constant Field Values

ENTRY_DELETED

public static final int ENTRY_DELETED
This event indicates that an entry has been removed from the map.
See Also:
Constant Field Values

m_nId

protected int m_nId
The event's id.

m_oKey

protected java.lang.Object m_oKey
A key.

m_oValueOld

protected java.lang.Object m_oValueOld
A previous value. May be null if not known.

m_oValueNew

protected java.lang.Object m_oValueNew
A new value. May be null if not known.

Constructor Detail

MapEvent

public MapEvent(ObservableMap map,
                int nId,
                java.lang.Object oKey,
                java.lang.Object oValueOld,
                java.lang.Object oValueNew)
Constructs a new MapEvent.
Parameters:
map - the ObservableMap object that fired the event
nId - this event's id, one of ENTRY_INSERTED, ENTRY_UPDATED or ENTRY_DELETED
oKey - the key into the map
oValueOld - the old value (for update and delete events)
oValueNew - the new value (for insert and update events)

Method Detail

getMap

public ObservableMap getMap()
Return an ObservableMap object on which this event has actually occured.
Returns:
an ObservableMap object

getId

public int getId()
Return this event's id. The event id is one of the ENTRY_* enumerated constants.
Returns:
an id

getKey

public java.lang.Object getKey()
Return a key associated with this event.
Returns:
a key

getOldValue

public java.lang.Object 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.

Returns:
an old value

getNewValue

public java.lang.Object 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.

Returns:
a new value

toString

public java.lang.String toString()
Return a String representation of this MapEvent object.
Overrides:
toString in class java.util.EventObject
Returns:
a String representation of this MapEvent object

dispatch

public void dispatch(Listeners listeners)
Dispatch this event to the specified listeners collection.

This call is equivalent to

   dispatch(listeners, true);
 
Parameters:
listeners - the listeners collection
Throws:
java.lang.ClassCastException - if any of the targets is not an instance of MapListener interface

dispatch

public void dispatch(Listeners listeners,
                     boolean fStrict)
Dispatch this event to the specified listeners collection.
Parameters:
listeners - the listeners collection
fStrict - if true then any RuntimeException thrown by event handlers stops all further event processing and the exception is re-thrown; if false then all exceptions are logged and the process continues
Throws:
java.lang.ClassCastException - if any of the targets is not an instance of MapListener interface

dispatch

public void dispatch(MapListener listener)
Dispatch this event to the specified MapListener.
Parameters:
listener - the listener

getDescription

protected java.lang.String getDescription()
Get the event's description.
Returns:
this event's description

getDescription

public static java.lang.String getDescription(int nId)
Convert an event ID into a human-readable string.
Parameters:
nId - an event ID, one of the ENTRY_* enumerated values
Returns:
a corresponding human-readable string, for example "inserted"

Skip navigation links

Oracle® Coherence Java API Reference
v3.5

E14977-01


Copyright © 2000, 2009, Oracle. All rights reserved.