Class AbstractExtractor
Abstract base for IValueExtractor implementations.
Inheritance
Inherited Members
Namespace: Tangosol.Util.Extractor
Assembly: Coherence.dll
Syntax
public abstract class AbstractExtractor : IValueExtractor, IQueryCacheComparer, IComparer
Remarks
It provides common functionality that allows any extending extractor to be used as a value Comparer.
Starting with Coherence 3.5, when used to extract information that is coming from a ICache, subclasses have the additional ability to operate against the ICacheEntry instead of just the value. In other words, like the EntryExtractor class, this allows an extractor implementation to extract a desired value using all available information on the corresponding ICacheEntry object and is intended to be used in advanced custom scenarios, when application code needs to look at both key and value at the same time or can make some very specific assumptions regarding to the implementation details of the underlying Entry object. To maintain full backwards compatibility, the default behavior remains to extract from the Value property of the ICacheEntry.
Note: Subclasses are responsible for initialization and POF and/or Lite serialization of the m_target field.
Fields
KEY
Indicates that the ExtractFromEntry(ICacheEntry) operation should use the Entry's value.
Declaration
public static readonly int KEY
Field Value
Type | Description |
---|---|
int |
VALUE
Indicates that the ExtractFromEntry(ICacheEntry) operation should use the Entry's value.
Declaration
public static readonly int VALUE
Field Value
Type | Description |
---|---|
int |
m_target
Specifies which part of the entry should be used by the ExtractFromEntry(ICacheEntry) operation. Legal values are VALUE (default) or KEY.
Declaration
protected int m_target
Field Value
Type | Description |
---|---|
int |
Remarks
Subclasses are responsible for initialization and POF and/or Lite serialization of this field.
Properties
Target
The target of the extractor.
Declaration
public int Target { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Compare(object, object)
Compares its two arguments for order.
Declaration
public virtual int Compare(object o1, object o2)
Parameters
Type | Name | Description |
---|---|---|
object | o1 | The first object to be compared. |
object | o2 | The second object to be compared. |
Returns
Type | Description |
---|---|
int | A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. |
Remarks
Returns a negative integer, zero, or a positive integer as the
first argument is less than, equal to, or greater than the
second. null
values are evaluated as "less then" any
non-null value.
CompareEntries(IQueryCacheEntry, IQueryCacheEntry)
Compare two entries.
Declaration
public virtual int CompareEntries(IQueryCacheEntry entry1, IQueryCacheEntry entry2)
Parameters
Type | Name | Description |
---|---|---|
IQueryCacheEntry | entry1 | The first entry to compare values from; read-only. |
IQueryCacheEntry | entry2 | The second entry to compare values from; read-only. |
Returns
Type | Description |
---|---|
int | A negative integer, zero, or a positive integer as the first entry denotes a value that is is less than, equal to, or greater than the value denoted by the second entry |
Exceptions
Type | Condition |
---|---|
InvalidCastException | If the arguments' types prevent them from being compared by this IComparer. |
ArgumentException | If the extractor cannot handle the passed objects for any other reason; an implementor should include a descriptive message. |
Extract(object)
Extract the value from the passed object.
Declaration
public virtual object Extract(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object to retrieve the value from. |
Returns
Type | Description |
---|---|
object | The extracted value as an object; |
Remarks
The returned value may be null
.
Exceptions
Type | Condition |
---|---|
InvalidCastException | If this IValueExtractor is incompatible with the passed object to extract a value from and the implementation requires the passed object to be of a certain type. |
ArgumentException | If this AbstractExtractor cannot handle the passed object for any other reason; an implementor should include a descriptive message. |
See Also
ExtractFromEntry(ICacheEntry)
Extract the value from the passed Entry object. The returned value should follow the conventions outlined in the Extract(object) method.
Declaration
public virtual object ExtractFromEntry(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | An Entry object to extract a desired value from |
Returns
Type | Description |
---|---|
object | The extracted value |
Remarks
By overriding this method, an extractor implementation is able to extract a desired value using all available information on the corresponding ICacheEntry object and is intended to be used in advanced custom scenarios, when application code needs to look at both key and value at the same time or can make some very specific assumptions regarding to the implementation details of the underlying Entry object.
ExtractOriginalFromEntry(CacheEntry)
Extract the value from the "original value" of the passed CacheEntry object or the key (if targeted). This method's conventions are exactly the same as the ExtractFromEntry(ICacheEntry) method.
Declaration
public virtual object ExtractOriginalFromEntry(CacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
CacheEntry | entry | A CacheEntry object whose original value should be used to extract the desired value from. |
Returns
Type | Description |
---|---|
object | The extracted value or null if the original value is not present. |