Class FilterTrigger
A generic Filter-based ICacheTrigger implementation.
Inherited Members
Namespace: Tangosol.Util.Filter
Assembly: Coherence.dll
Syntax
[Serializable]
public class FilterTrigger : ICacheTrigger, IPortableObject
Remarks
If an evaluation of the ICacheTriggerEntry object representing a pending change fails (returns false), then one of the following actions is taken:
- Rollback - an ArgumentException is thrown by the trigger to reject the operation that would result in this change (default);
- Ignore - the change is ignored and the entry's value is reset to the original value returned by the OriginalValue;
- Remove - the entry is removed from the underlying backing cache using the Remove(bool) call.
Constructors
FilterTrigger()
Default constructor.
Declaration
public FilterTrigger()
FilterTrigger(IFilter)
Declaration
public FilterTrigger(IFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IFilter | filter | The underlying IFilter. |
FilterTrigger(IFilter, ActionCode)
Construct a FilterTrigger based on the specified IFilter object and the action code.
Declaration
public FilterTrigger(IFilter filter, FilterTrigger.ActionCode action)
Parameters
Type | Name | Description |
---|---|---|
IFilter | filter | The underlying IFilter. |
FilterTrigger.ActionCode | action | One of the FilterTrigger.ActionCode values. |
Fields
m_action
The action code.
Declaration
protected FilterTrigger.ActionCode m_action
Field Value
Type | Description |
---|---|
FilterTrigger.ActionCode |
m_filter
The underlying filter.
Declaration
protected IFilter m_filter
Field Value
Type | Description |
---|---|
IFilter |
Properties
Action
The action code for this FilterTrigger.
Declaration
public virtual FilterTrigger.ActionCode Action { get; }
Property Value
Type | Description |
---|---|
FilterTrigger.ActionCode | One of the FilterTrigger.ActionCode values. |
Filter
Obtain the underlying IFilter.
Declaration
public virtual IFilter Filter { get; }
Property Value
Type | Description |
---|---|
IFilter | The underlying IFilter object. |
Methods
Equals(object)
Compare the FilterTrigger with another object to determine equality.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | The FilterTrigger to compare to. |
Returns
Type | Description |
---|---|
bool | true iff this FilterTrigger and the passed object are equivalent FilterTrigger objects. |
Overrides
Remarks
Two FilterTrigger objects are considered equal iff the wrapped filters and action codes are equal.
GetHashCode()
Determine a hash value for the FilterTrigger object according to the general GetHashCode() contract.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | An integer hash value for this FilterTrigger object. |
Overrides
Process(ICacheTriggerEntry)
This method is called before the result of a mutating operation represented by the specified entry object is committed into the underlying cache.
Declaration
public virtual void Process(ICacheTriggerEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheTriggerEntry | entry | An ICacheTriggerEntry object that represents the pending change to be committed to the cache, as well as the original state of the entry. |
Remarks
An implementation of this method can evaluate the change by analyzing the original and the new value, and can perform any of the following:
- override the requested change by setting Value to a different value;
- undo the pending change by resetting the entry value to the original value obtained from OriginalValue
- remove the entry from the underlying cache by calling Remove(bool)
- reject the pending change by throwing an Exception, which will prevent any changes from being committed, and will result in the exception being thrown from the operation that attempted to modify the cache; or
- do nothing, thus allowing the pending change to be committed to the underlying cache.
ReadExternal(IPofReader)
Restore the contents of a user type instance by reading its state using the specified IPofReader object.
Declaration
public virtual void ReadExternal(IPofReader reader)
Parameters
Type | Name | Description |
---|---|---|
IPofReader | reader | The IPofReader from which to read the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
ToString()
Return a human-readable description for this FilterTrigger.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string description of the FilterTrigger. |
Overrides
WriteExternal(IPofWriter)
Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.
Declaration
public virtual void WriteExternal(IPofWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IPofWriter | writer | The IPofWriter to which to write the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |