#include <coherence/util/MapEvent.hpp>
Inherits EventObject.
Inherited by CacheEvent, and ConverterCollections::ConverterMapEvent.
Public Types | |
typedef spec::Handle | Handle |
MapEvent Handle definition. | |
typedef spec::View | View |
MapEvent View definition. | |
typedef spec::Holder | Holder |
MapEvent Holder definition. | |
Public Member Functions | |
virtual TypedHandle < ObservableMap > | getMap () const |
Return an ObservableMap object on which this event has actually occured. | |
virtual int32_t | getId () const |
Return this event's id. | |
virtual Object::View | getKey () const |
Return a key associated with this event. | |
virtual Object::View | getOldValue () const |
Return an old value associated with this event. | |
virtual Object::View | getNewValue () const |
Return a new value associated with this event. | |
virtual TypedHandle < const String > | toString () const |
Output a human-readable description of this Object to the given stream. Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents and is generally how toString() will be implemented.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::View vs = COH_TO_STRING(vKey << " = " << vValue); The COH_TO_STRING macro is also the most common way to implement the toString method. For example:
virtual TypedHandle<const String> Person::toString() const { return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN); }
| |
virtual void | dispatch (Listeners::View vListeners) const |
Dispatch this event to the specified listeners collection. | |
virtual void | dispatch (Listeners::View vListeners, bool fStrict) const |
Dispatch this event to the specified listeners collection. | |
virtual void | dispatch (TypedHandle< MapListener > hListener) const |
Dispatch this event to the specified MapListener. | |
virtual String::View | getDescription () const |
Return a human-readable description of the state of this class in the form of a delimited list of name-value pairs.
The default implementation returns an empty string | |
Static Public Member Functions | |
static String::View | getDescription (int32_t nId) |
Convert an event ID into a human-readable string. | |
Static Public Attributes | |
static const int32_t | entry_inserted |
This event indicates that an entry has been added to the map. | |
static const int32_t | entry_updated |
This event indicates that an entry has been updated in the map. | |
static const int32_t | entry_deleted |
This event indicates that an entry has been removed from the map. | |
Protected Member Functions | |
MapEvent (TypedHandle< ObservableMap > hMap, int32_t nId, Object::View vKey, Object::View vValueOld, Object::View vValueNew) | |
Create a MapEvent. | |
Protected Attributes | |
int32_t | m_nId |
The event's id. | |
MemberView< Object > | m_voKey |
A key. | |
MemberView< Object > | m_voValueOld |
A previous value. | |
MemberView< Object > | m_voValueNew |
A new value. |
MapEvent | ( | TypedHandle< ObservableMap > | hMap, | |
int32_t | nId, | |||
Object::View | vKey, | |||
Object::View | vValueOld, | |||
Object::View | vValueNew | |||
) | [protected] |
virtual TypedHandle<ObservableMap> getMap | ( | ) | const [virtual] |
Return an ObservableMap object on which this event has actually occured.
virtual int32_t getId | ( | ) | const [virtual] |
Return this event's id.
The event id is one of the entry_* enumerated constants.
virtual Object::View getKey | ( | ) | const [virtual] |
Return a key associated with this event.
Reimplemented in ConverterCollections::ConverterCacheEvent, ConverterCollections::ConverterMapEvent, and MapListenerSupport::FilterEvent.
virtual Object::View getOldValue | ( | ) | const [virtual] |
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.
Reimplemented in ConverterCollections::ConverterCacheEvent, ConverterCollections::ConverterMapEvent, and MapListenerSupport::FilterEvent.
virtual Object::View getNewValue | ( | ) | const [virtual] |
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.
Reimplemented in ConverterCollections::ConverterCacheEvent, ConverterCollections::ConverterMapEvent, and MapListenerSupport::FilterEvent.
virtual void dispatch | ( | Listeners::View | vListeners | ) | const [virtual] |
Dispatch this event to the specified listeners collection.
This call is equivalent to
dispatch(listeners, true);
vListeners | the listeners collection |
ClassCastException | if any of the targets is not an instance of MapListener interface |
virtual void dispatch | ( | Listeners::View | vListeners, | |
bool | fStrict | |||
) | const [virtual] |
Dispatch this event to the specified listeners collection.
vListeners | 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 |
ClassCastException | if any of the targets is not an instance of MapListener interface |
virtual void dispatch | ( | TypedHandle< MapListener > | hListener | ) | const [virtual] |
static String::View getDescription | ( | int32_t | nId | ) | [static] |
Convert an event ID into a human-readable string.
nId | an event ID, one of the entry_* enumerated values |
MemberView<Object> m_voKey [mutable, protected] |
A key.
This is mutable because subclasses may lazily initialize this value from an accessor.
MemberView<Object> m_voValueOld [mutable, protected] |
A previous value.
May be NULL if not known. This is mutable because subclasses may lazily initialize this value from an accessor.
MemberView<Object> m_voValueNew [mutable, protected] |
A new value.
May be NULL if not known. This is mutable because subclasses may lazily initialize this value from an accessor.