#include <coherence/util/extractor/MultiExtractor.hpp>
Inherits AbstractCompositeExtractor.
All extractors in the array are applied to the same target object and the result of the extraction is a List 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.
Public Types | |||||||||||||
typedef spec::Handle | Handle | ||||||||||||
MultiExtractor Handle definition. | |||||||||||||
typedef spec::View | View | ||||||||||||
MultiExtractor View definition. | |||||||||||||
typedef spec::Holder | Holder | ||||||||||||
MultiExtractor Holder definition. | |||||||||||||
Public Member Functions | |||||||||||||
virtual Object::Holder | extract (Object::Holder ohTarget) const | ||||||||||||
Extract the value from the passed object. The returned value may be NULL.
| |||||||||||||
virtual Object::Holder | extractFromEntry (Map::Entry::Holder ohEntry) const | ||||||||||||
Extract the value from the passed entry. | |||||||||||||
virtual int32_t | compareEntries (QueryMap::Entry::View vEntry1, QueryMap::Entry::View vEntry2) const | ||||||||||||
Compare two entries based on the rules specified by Comparator. If possible, use the coherence::util::QueryMap.Entry::extract() method to optimize the value extraction process. This method is expected to be implemented by Comparator wrappers, such as ChainedComparator and InverseComparator, which simply pass on this invocation to the wrapped Comparator 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 ValueExtractor implementations that implement the Comparator interface. It is expected that in most cases, the Comparator wrappers will eventually terminate at (i.e. delegate to) ValueExtractors that also implement this interface.
| |||||||||||||
Static Public Member Functions | |||||||||||||
static ObjectArray::View | createExtractors (String::View vsNames) | ||||||||||||
Parse a comma-delimited sequence of method names and instantiate a corresponding array ValueExtractor objects. | |||||||||||||
Protected Member Functions | |||||||||||||
MultiExtractor () | |||||||||||||
Default constructor (necessary for the PortableObject interface). | |||||||||||||
MultiExtractor (ObjectArray::View vaExtractor) | |||||||||||||
Construct a MultiExtractor. |
MultiExtractor | ( | ObjectArray::View | vaExtractor | ) | [protected] |
virtual Object::Holder extractFromEntry | ( | Map::Entry::Holder | ohEntry | ) | const [virtual] |
Extract the value from the passed entry.
The underlying extractors are applied sequentially, so a result of a previous extractor serves as a target object for a next one. A value of NULL prevents any further extractions and is returned immediately. For intrinsic types, the returned value is expected to be a standard wrapper type in the same manner that reflection works; for example, int32_t would be returned as a Integer32.
Reimplemented from AbstractExtractor.
static ObjectArray::View createExtractors | ( | String::View | vsNames | ) | [static] |
Parse a comma-delimited sequence of method names and instantiate a corresponding array ValueExtractor objects.
Individual array elements will be either ReflectionExtractor or ChainedExtractor objects.
vsNames | a comma-delimited sequence of method names |