Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.1.0)

E69640-01

MapEvent Class Reference

#include <coherence/util/MapEvent.hpp>

Inherits EventObject.

Inherited by CacheEvent, and ConverterCollections::ConverterMapEvent.

List of all members.


Detailed Description

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:
js 2008.06.03

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);
     }

Returns:
a string representation of this object

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< Objectm_voKey
 A key.
MemberView< Objectm_voValueOld
 A previous value.
MemberView< Objectm_voValueNew
 A new value.

Constructor & Destructor Documentation

MapEvent ( TypedHandle< ObservableMap >  hMap,
int32_t  nId,
Object::View  vKey,
Object::View  vValueOld,
Object::View  vValueNew 
) [protected]

Create a MapEvent.

Parameters:
hMap the map on which the Event initially occurred
nId the events id (entry_inserted | entry_updated | entry_deleted)
vKey the key into the map
vValueOld the old value (for update and delete events)
vValueNew the new value (for insert and update events)


Member Function Documentation

virtual TypedHandle<ObservableMap> getMap (  )  const [virtual]

Return an ObservableMap object on which this event has actually occured.

Returns:
an ObservableMap object

virtual int32_t getId (  )  const [virtual]

Return this event's id.

The event id is one of the entry_* enumerated constants.

Returns:
an id

virtual Object::View getKey (  )  const [virtual]

Return a key associated with this event.

Returns:
a key

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.

Returns:
an old value

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.

Returns:
a new value

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);
 

Parameters:
vListeners the listeners collection
Exceptions:
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.

Parameters:
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
Exceptions:
ClassCastException if any of the targets is not an instance of MapListener interface

virtual void dispatch ( TypedHandle< MapListener hListener  )  const [virtual]

Dispatch this event to the specified MapListener.

Parameters:
hListener the listener

static String::View getDescription ( int32_t  nId  )  [static]

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"


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Copyright © 2000, 2016, Oracle and/or its affiliates. All rights reserved.