Show / Hide Table of Contents

Class ExtractorEventTransformer

ExtractorEventTransformer is a special purpose ICacheEventTransformer implementation that transforms emitted events, extracting one or more properties from either the "OldValue" or the "NewValue".

Inheritance
object
ExtractorEventTransformer
Implements
ICacheEventTransformer
IPortableObject
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Tangosol.Util.Transformer
Assembly: Coherence.dll
Syntax
public class ExtractorEventTransformer : ICacheEventTransformer, IPortableObject
Remarks

This transformation will generally result in the change of the values' data type.

Example: the following code will register a listener to receive events only if the value of the "AccountBalance" property changes. The transformed event's "NewValue" will be a IList containing the "LastTransactionTime" and "AccountBalance" properties. The "OldValue" will always be null.
IFilter filter = new ValueChangeEventFilter("AccountBalance");
IValueExtractor extractor = new MultiExtractor("LastTransactionTime,AccountBalance");
ICacheEventTransformer transformer = new ExtractorEventTransformer(null, extractor);

cache.AddCacheListener(listener, new CacheEventTransformerFilter(filter, transformer), false);

Constructors

ExtractorEventTransformer()

Default constructor.

Declaration
public ExtractorEventTransformer()

ExtractorEventTransformer(string)

Construct a ExtractorEventTransformer that transforms CacheEventArgs's values based on the specified method name.

Declaration
public ExtractorEventTransformer(string methodName)
Parameters
Type Name Description
string methodName

The name of the method to invoke via reflection.

Remarks

The name could be a comma-delimited sequence of method names which will result in a MultiExtractor that is based on a corresponding array of IValueExtractor objects; individual array elements will be either ReflectionExtractor or ChainedExtractor objects.

Note: The specified extractor will be applied to both old and new values.

ExtractorEventTransformer(IValueExtractor)

Construct a ExtractorEventTransformer that transforms CacheEventArgs values based on the specified extractor.

Declaration
public ExtractorEventTransformer(IValueExtractor extractor)
Parameters
Type Name Description
IValueExtractor extractor

IValueExtractor to extract CacheEventArgs values.

Remarks

Note: The specified extractor will be applied to both old and new values.

ExtractorEventTransformer(IValueExtractor, IValueExtractor)

Construct a ExtractorEventTransformer that transforms CacheEventArgs values based on the specified extractors.

Declaration
public ExtractorEventTransformer(IValueExtractor extractorOld, IValueExtractor extractorNew)
Parameters
Type Name Description
IValueExtractor extractorOld

Extractor to extract the OldValue property(s).

IValueExtractor extractorNew

Extractor to extract the NewValue property(s).

Remarks

Passing null indicates that the corresponding values should be skipped completely.

Properties

NewValueExtractor

Return a IValueExtractor used to transfrom the event's NewValue.

Declaration
public virtual IValueExtractor NewValueExtractor { get; }
Property Value
Type Description
IValueExtractor

An extractor from the NewValue.

OldValueExtractor

Return a IValueExtractor used to transfrom the event's OldValue.

Declaration
public virtual IValueExtractor OldValueExtractor { get; }
Property Value
Type Description
IValueExtractor

An extractor from the OldValue.

Methods

Equals(object)

Compare the ExtractorEventTransformer with another object to determine equality.

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
object o

The object to compare with the current object.

Returns
Type Description
bool

true if this ExtractorEventTransformer and the passed object are equivalent.

Overrides
object.Equals(object)

Equals(ExtractorEventTransformer)

Compare the ExtractorEventTransformer with another object to determine equality.

Declaration
public bool Equals(ExtractorEventTransformer that)
Parameters
Type Name Description
ExtractorEventTransformer that

The object to compare with the current object.

Returns
Type Description
bool

true if this ExtractorEventTransformer and the passed object are equivalent.

GetHashCode()

Determine a hash value for the ExtractorEventTransformer object according to the general Object.GetHashCode contract.

Declaration
public override int GetHashCode()
Returns
Type Description
int

An integer hash value for this object.

Overrides
object.GetHashCode()

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

Provide a human-readable representation of this object.

Declaration
public override string ToString()
Returns
Type Description
string

A String whose contents represent the value of this object.

Overrides
object.ToString()

Transform(CacheEventArgs)

Transform the specified CacheEventArgs using the corresponding extractors.

Declaration
public virtual CacheEventArgs Transform(CacheEventArgs eventArgs)
Parameters
Type Name Description
CacheEventArgs eventArgs

CacheEventArgs object to transform.

Returns
Type Description
CacheEventArgs

A modified CacheEventArgs object that contains extracted values.

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.

Implements

ICacheEventTransformer
IPortableObject
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.