Class MultiExtractor
Composite IValueExtractor implementation based on an array of extractors.
Inherited Members
Namespace: Tangosol.Util.Extractor
Assembly: Coherence.dll
Syntax
public class MultiExtractor : AbstractCompositeExtractor, IValueExtractor, IQueryCacheComparer, IComparer, IPortableObject
Remarks
All extractors in the array are applied to the same target object and the result of the extraction is an IList of extracted values.
Common scenarios for using the MultiExtractor involve the DistinctValues or GroupAggregator aggregators, that allow clients to collect all distinct combinations of a given set of attributes or collect and run additional aggregation against the corresponding groups of entries.
Constructors
MultiExtractor()
Default constructor.
Declaration
public MultiExtractor()
MultiExtractor(string)
Construct a MultiExtractor for a specified member name list.
Declaration
public MultiExtractor(string memberNames)
Parameters
Type | Name | Description |
---|---|---|
string | memberNames | A comma-delimited sequence of member names which results in a MultiExtractor that is based on a corresponding array of IValueExtractor objects; individual array elements will be either ReflectionExtractor or ChainedExtractor objects |
MultiExtractor(IValueExtractor[])
Construct a MultiExtractor.
Declaration
public MultiExtractor(IValueExtractor[] extractors)
Parameters
Type | Name | Description |
---|---|---|
IValueExtractor[] | extractors | The IValueExtractor array. |
Methods
CompareEntries(IQueryCacheEntry, IQueryCacheEntry)
Compare two entries based on the rules specified by IComparer.
Declaration
public override 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. |
Overrides
Remarks
If possible, use the Extract(IValueExtractor) method to optimize the value extraction process.
This method is expected to be implemented by IComparer wrappers, which simply pass on this invocation to the wrapped IComparer objects if they too implement this interface, or to invoke their default compare method passing the actual objects (not the extracted values) obtained from the extractor using the passed entries.
This interface is also expected to be implemented by IValueExtractor implementations that implement the IComparer interface. It is expected that in most cases, the IComparer wrappers will eventually terminate at (i.e. delegate to) IValueExtractors that also implement this interface.
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 a collection of values from the passed object using the underlying array of IValueExtractor objects.
Declaration
public override object Extract(object target)
Parameters
Type | Name | Description |
---|---|---|
object | target | An Object to retrieve the collection of values from. |
Returns
Type | Description |
---|---|
object | A List containing the extracted values or |
Overrides
Remarks
Note that each individual value could be an object of a standard
wrapper type (for intrinsic types) or null
.
ExtractFromEntry(ICacheEntry)
Extract a collection of values from the passed entry using the underlying array of IValueExtractor objects.
Declaration
public override object ExtractFromEntry(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | An entry to retrieve the collection of values from |
Returns
Type | Description |
---|---|
object | An array containing extracted values |