#include <coherence/util/filter/FilterTrigger.hpp>
Inherits Object, PortableObject, and MapTrigger.
If an evaluation of the coherence::util::MapTrigger::Entry object representing a pending change fails (returns false), then one of the following actions is taken:
Note: This trigger never prevents entries from being removed.
Public Types | ||||
typedef spec::Handle | Handle | |||
FilterTrigger Handle definition. | ||||
typedef spec::View | View | |||
FilterTrigger View definition. | ||||
typedef spec::Holder | Holder | |||
FilterTrigger Holder definition. | ||||
Public Member Functions | ||||
virtual void | process (MapTrigger::Entry::Handle vEntry) | |||
This method is called before the result of a mutating operation represented by the specified Entry object is committed into the underlying map. An implementation of this method can evaluate the change by analyzing the original and the new value, and can perform any of the following:
| ||||
virtual void | readExternal (PofReader::Handle hIn) | |||
virtual void | writeExternal (PofWriter::Handle hOut) const | |||
virtual bool | equals (Object::View v) const | |||
Compare the FilterTrigger with another object to determine equality. | ||||
virtual size32_t | hashCode () const | |||
Return a hash code value for the Object. This method is supported for the benefit of hash-based containers.
The general contract of
The default implementation is identity based.
| ||||
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 Filter::View | getFilter () const | |||
Obtain the underlying Filter. | ||||
virtual int32_t | getAction () const | |||
Obtain the action code for this FilterTrigger. | ||||
Static Public Attributes | ||||
static const int32_t | action_rollback | |||
Evaluation failure results in an IllegalArgumentException thrown by the trigger. | ||||
static const int32_t | action_ignore | |||
Evaluation failure results in restoring the original Entry's value. | ||||
static const int32_t | action_remove | |||
Evaluation failure results in a removal of the entry. | ||||
Protected Member Functions | ||||
FilterTrigger () | ||||
Default constructor (necessary for the PortableObject interface). | ||||
FilterTrigger (Filter::View vFilter, int32_t nAction=action_rollback) | ||||
Construct a FilterTrigger based on the specified Filter object and the action constant. | ||||
Protected Attributes | ||||
FinalView< Filter > | f_vFilter | |||
The underlying filter. | ||||
int32_t | m_nAction | |||
The action code. |
FilterTrigger | ( | Filter::View | vFilter, | |
int32_t | nAction = action_rollback | |||
) | [protected] |
Construct a FilterTrigger based on the specified Filter object and the action constant.
vFilter | the underlying Filter | |
nAction | one of the ACTION_* constants, default is action_rollback |
virtual bool equals | ( | Object::View | v | ) | const [virtual] |
Compare the FilterTrigger with another object to determine equality.
Two FilterTrigger objects are considered equal iff the wrapped filters and action codes are equal.
virtual Filter::View getFilter | ( | ) | const [virtual] |
virtual int32_t getAction | ( | ) | const [virtual] |