|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.MapListenerSupport
public class MapListenerSupport
This class provides support for advanced MapListener functionality.
Nested Class Summary | |
---|---|
static class |
MapListenerSupport.FilterEvent
An extension of the CacheEvent which may carry no values (old or new), but instead holds on an array of Filter objects being the "cause" of the event. |
static interface |
MapListenerSupport.SynchronousListener
A tag interface indicating that tagged MapListener implementation has to receive the MapEvent notifications in a synchronous manner. |
static class |
MapListenerSupport.WrapperSynchronousListener
A wrapper class that turns the specified MapListener into a synchronous listener. |
Field Summary | |
---|---|
protected Listeners |
m_listenersCached
A cached set of Listeners. |
protected Map |
m_mapKeyListeners
The collections of MapListener objects that have signed up for key based notifications from an ObservableMap implementation keyed by the corresponding key objects. |
protected Map |
m_mapListeners
The collections of MapListener objects that have signed up for notifications from an ObservableMap implementation keyed by the corresponding Filter objects. |
protected Map |
m_mapStandardKeyListeners
The subset of standard (not lite) key listeners. |
protected Map |
m_mapStandardListeners
The subset of standard (not lite) global listeners. |
protected int |
m_nOptimizationPlan
The optimization plan which indicates the fastest way to put together a set of listeners. |
protected Listeners |
NO_LISTENERS
An empty set of Listeners. |
protected static int |
PLAN_ALL_LISTENER
There is one all-keys non-filtered listener. |
protected static int |
PLAN_KEY_LISTENER
There is one key listener (even if for multiple keys). |
protected static int |
PLAN_NO_LISTENERS
There are no listeners. |
protected static int |
PLAN_NO_OPTIMIZE
There is no optimized plan, so just use the default approach. |
protected static int |
PLAN_NONE
A plan has not yet been formed. |
Constructor Summary | |
---|---|
MapListenerSupport()
Constructs a new MapListenerSupport object. |
Method Summary | |
---|---|
void |
addListener(MapListener listener,
Filter filter,
boolean fLite)
Add a map listener that receives events based on a filter evaluation. |
void |
addListener(MapListener listener,
Object oKey,
boolean fLite)
Add a map listener for a specific key. |
protected static void |
addListenerState(Map mapStandardListeners,
Object anyKey,
MapListener listener,
boolean fLite)
Add a state information (lite or standard) assosiated with specified key and listener. |
protected static void |
addSafeListener(Map mapListeners,
Object anyKey,
MapListener listener)
Ensure that the specified map has an Listeners object assosiated with the specified key and add the specified listener to it. |
void |
clear()
Remove all signed up listeners. |
Listeners |
collectListeners(MapEvent event)
Collect all Listeners that should be notified for a given event. |
boolean |
containsStandardListeners(Filter filter)
Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given filter. |
boolean |
containsStandardListeners(Object oKey)
Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given key. |
static MapEvent |
convertEvent(MapEvent event,
ObservableMap mapConv,
Converter convKey,
Converter convVal)
Convert the specified map event into another MapEvent that ensures the lazy event data conversion using the specified converters. |
void |
fireEvent(MapEvent event,
boolean fStrict)
Fire the specified map event. |
Set |
getFilterSet()
Obtain a set of all filters that have assosiated global listeners. |
Set |
getKeySet()
Obtain a set of all keys that have assosiated key listeners. |
Listeners |
getListeners(Filter filter)
Obtain the Listeners object for a given filter. |
Listeners |
getListeners(Object oKey)
Obtain the Listeners object for a given key. |
boolean |
isEmpty()
Checks whether or not this MapListenerSupport object contains any listeners. |
boolean |
isEmpty(Filter filter)
Checks whether or not this MapListenerSupport object contains any listeners for a given filter. |
boolean |
isEmpty(Object oKey)
Checks whether or not this MapListenerSupport object contains any listeners for a given key. |
void |
removeListener(MapListener listener,
Filter filter)
Remove a map listener that previously signed up for events based on a filter evaluation. |
void |
removeListener(MapListener listener,
Object oKey)
Remove a map listener that previously signed up for events about a specific key. |
protected static void |
removeListenerState(Map mapStandardListeners,
Object anyKey,
MapListener listener)
Remove a state information (lite or standard) assosiated with specified key and listener. |
protected static void |
removeSafeListener(Map mapListeners,
Object anyKey,
MapListener listener)
Remove the specified listener from the Listeners object assosiated with the specified key. |
String |
toString()
Provide a string representation of the MapListenerSupport object. |
Field Detail |
---|
protected static final int PLAN_NONE
protected static final int PLAN_NO_LISTENERS
protected static final int PLAN_ALL_LISTENER
protected static final int PLAN_KEY_LISTENER
protected static final int PLAN_NO_OPTIMIZE
protected final Listeners NO_LISTENERS
protected Map m_mapListeners
protected Map m_mapKeyListeners
protected Map m_mapStandardListeners
protected Map m_mapStandardKeyListeners
protected int m_nOptimizationPlan
protected Listeners m_listenersCached
Constructor Detail |
---|
public MapListenerSupport()
Method Detail |
---|
public void addListener(MapListener listener, Filter filter, boolean fLite)
listener
- the listener to addfilter
- a filter that will be passed MapEvent objects to
select from; a MapEvent will be delivered to the
listener only if the filter evaluates to true for
that MapEvent; null is equivalent to a filter
that alway returns truefLite
- true to indicate that the MapEvent objects do
not have to include the OldValue and NewValue
property values in order to allow optimizationspublic void addListener(MapListener listener, Object oKey, boolean fLite)
listener
- the listener to addoKey
- the key that identifies the entry for which to raise
eventsfLite
- true to indicate that the MapEvent objects do
not have to include the OldValue and NewValue
property values in order to allow optimizationspublic void removeListener(MapListener listener, Filter filter)
listener
- the listener to removefilter
- a filter used to evaluate eventspublic void removeListener(MapListener listener, Object oKey)
listener
- the listener to removeoKey
- the key that identifies the entry for which to raise
eventspublic void clear()
public boolean isEmpty()
public boolean isEmpty(Filter filter)
filter
- the filter
public boolean isEmpty(Object oKey)
oKey
- the key
public boolean containsStandardListeners(Filter filter)
filter
- the filter
public boolean containsStandardListeners(Object oKey)
oKey
- the key
public Set getFilterSet()
public Set getKeySet()
public Listeners getListeners(Filter filter)
filter
- the filter
public Listeners getListeners(Object oKey)
oKey
- the key
public Listeners collectListeners(MapEvent event)
event
- the MapEvent object
public void fireEvent(MapEvent event, boolean fStrict)
event
- the map eventfStrict
- 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 continuespublic static MapEvent convertEvent(MapEvent event, ObservableMap mapConv, Converter convKey, Converter convVal)
event
- the map eventmapConv
- the source for the converted eventconvKey
- (optional) the key ConverterconvVal
- (optional) the value converter
protected static void addSafeListener(Map mapListeners, Object anyKey, MapListener listener)
protected static void removeSafeListener(Map mapListeners, Object anyKey, MapListener listener)
protected static void addListenerState(Map mapStandardListeners, Object anyKey, MapListener listener, boolean fLite)
protected static void removeListenerState(Map mapStandardListeners, Object anyKey, MapListener listener)
public String toString()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |