C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/util/extractor/MultiExtractor.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_MULTI_EXTRACTOR_HPP
00008 #define COH_MULTI_EXTRACTOR_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/util/QueryMap.hpp"
00013 #include "coherence/util/ValueExtractor.hpp"
00014 #include "coherence/util/extractor/AbstractCompositeExtractor.hpp"
00015 
00016 COH_OPEN_NAMESPACE3(coherence,util,extractor)
00017 
00018 
00019 /**
00020 * Composite ValueExtractor implementation based on an array of extractors.
00021 * All extractors in the array are applied to the same target object and the
00022 * result of the extraction is a List of extracted values.
00023 *
00024 * Common scenarios for using the MultiExtractor involve the DistinctValues or
00025 * GroupAggregator aggregators, that allow clients to collect all distinct
00026 * combinations of a given set of attributes or collect and run additional
00027 * aggregation against the corresponding groups of entries.
00028 *
00029 * @author djl 2008.04.09
00030 */
00031 class COH_EXPORT MultiExtractor
00032     : public class_spec<MultiExtractor,
00033         extends<AbstractCompositeExtractor> >
00034     {
00035     friend class factory<MultiExtractor>;
00036 
00037     // ----- constructors ---------------------------------------------------
00038 
00039     protected:
00040         /**
00041         * Default constructor (necessary for the PortableObject interface).
00042         */
00043         MultiExtractor();
00044 
00045         /**
00046         * Construct a MultiExtractor.
00047         *
00048         * @param vaExtractor  the ValueExtractor array
00049         */
00050         MultiExtractor(ObjectArray::View vaExtractor);
00051 
00052     private:
00053         /**
00054         * Blocked copy constructor.
00055         */
00056         MultiExtractor(const MultiExtractor&);
00057 
00058 
00059     // ----- AbstractExtractor methods --------------------------------------
00060 
00061     public:
00062         /**
00063         * {@inheritDoc}
00064         */
00065         virtual Object::Holder extract(Object::Holder ohTarget) const;
00066 
00067         /**
00068         * Extract the value from the passed entry. The underlying extractors
00069         * are applied sequentially, so a result of a previous extractor serves
00070         * as a target object for a next one. A value of NULL prevents any
00071         * further extractions and is returned immediately. For intrinsic types,
00072         * the returned value is expected to be a standard wrapper type in the
00073         * same manner that reflection works; for example, int32_t would be
00074         * returned as a Integer32.
00075         */
00076         virtual Object::Holder extractFromEntry(Map::Entry::Holder ohEntry) const;
00077 
00078 
00079     // ----- QueryMapComparator interface -----------------------------------
00080 
00081     public:
00082         /**
00083         * {@inheritDoc}
00084         */
00085         virtual int32_t compareEntries(QueryMap::Entry::View vEntry1,
00086                 QueryMap::Entry::View vEntry2) const;
00087 
00088 
00089     // ----- helpers --------------------------------------------------------
00090 
00091     public:
00092         /**
00093         * Parse a comma-delimited sequence of method names and instantiate
00094         * a corresponding array ValueExtractor objects. Individual array
00095         * elements will be either ReflectionExtractor or ChainedExtractor
00096         * objects.
00097         *
00098         * @param vsNames  a comma-delimited sequence of method names
00099         *
00100         * @return an array of ValueExtractor objects
00101         */
00102         static ObjectArray::View createExtractors(String::View vsNames);
00103     };
00104 
00105 COH_CLOSE_NAMESPACE3
00106 
00107 #endif // COH_MULTI_EXTRACTOR_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.