Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.3.0)

E80355-01

coherence/util/NullImplementation.hpp

00001 /*
00002 * NullImplementation.hpp
00003 *
00004 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_NULL_IMPLEMENTATION_HPP
00017 #define COH_NULL_IMPLEMENTATION_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/pof/PofReader.hpp"
00022 #include "coherence/io/pof/PofWriter.hpp"
00023 #include "coherence/io/pof/PortableObject.hpp"
00024 #include "coherence/util/AbstractSet.hpp"
00025 #include "coherence/util/Converter.hpp"
00026 #include "coherence/util/Filter.hpp"
00027 #include "coherence/util/MapListener.hpp"
00028 #include "coherence/util/ObservableMap.hpp"
00029 #include "coherence/util/ValueExtractor.hpp"
00030 
00031 COH_OPEN_NAMESPACE2(coherence,util)
00032 
00033 using coherence::io::pof::PofReader;
00034 using coherence::io::pof::PofWriter;
00035 using coherence::io::pof::PortableObject;
00036 using coherence::util::AbstractSet;
00037 using coherence::util::MapListener;
00038 using coherence::util::ObservableMap;
00039 using coherence::util::ValueExtractor;
00040 
00041 /**
00042 * A collection of classes that do nothing.
00043 * For each class implemented, a factory method will exist following the
00044 * naming convention "get" plus the class or interface name.
00045 *
00046 * @author gm  2008.07.28
00047 */
00048 class COH_EXPORT NullImplementation
00049     {
00050     // ----- NullImplementation interface -----------------------------------
00051 
00052     public:
00053         /**
00054         * Returns an instance of the empty ObjectArray.
00055         */
00056         static ObjectArray::Handle getArray();
00057 
00058         /**
00059         * Factory method:  Obtain a null implementation of a Converter.
00060         *
00061         * @return a conforming implementation of Converter that does as little
00062         *         as possible
00063         *
00064         * @since Coherence 3.7.1
00065         */
00066         static Converter::Handle getConverter();
00067 
00068         /**
00069         * Returns an instance of the NullIterator.
00070         */
00071         static Iterator::Handle getIterator();
00072 
00073         /**
00074         * Returns an instance of the NullMuterator.
00075         */
00076         static Muterator::Handle getMuterator();
00077 
00078         /**
00079         * Returns an instance of the NullSet.
00080         */
00081         static Set::Handle getSet();
00082 
00083         /**
00084         * Returns an instance of the NullCollection.
00085         */
00086         static Collection::Handle getCollection();
00087 
00088         /**
00089         * Returns an instance of the NullMap.
00090         */
00091         static Map::Handle getMap();
00092 
00093         /**
00094         * Returns an instance of the NullObservableMap.
00095         */
00096         static ObservableMap::Handle getObservableMap();
00097 
00098         /**
00099         * Returns an instance of the NullValueExtractor.
00100         */
00101         static ValueExtractor::Handle getValueExtractor();
00102 
00103 
00104     // ----- Inner class: NullConverter -------------------------------------
00105 
00106     public:
00107         class COH_EXPORT NullConverter
00108             : public class_spec<NullConverter,
00109                      extends<Object>,
00110                      implements<Converter> >
00111             {
00112             friend class factory<NullImplementation::NullConverter>;
00113 
00114             // ----- constructors ---------------------------------------
00115 
00116             protected:
00117                 /**
00118                 * Default constructor.
00119                 */
00120                 NullConverter();
00121 
00122 
00123             // ----- Converter interface --------------------------------
00124 
00125             public:
00126                 /**
00127                 * {@inheritDoc}
00128                 */
00129                 virtual Object::Holder convert(Object::Holder oh) const;
00130 
00131             public:
00132                 static Handle getInstance();
00133             };
00134 
00135 
00136     // ----- Inner class: NullMuterator -------------------------------------
00137 
00138     public:
00139         class COH_EXPORT NullMuterator
00140             : public class_spec<NullMuterator,
00141                      extends<Object>,
00142                      implements<Muterator> >
00143             {
00144             friend class factory<NullImplementation::NullMuterator>;
00145 
00146             // ----- constructors ---------------------------------------
00147 
00148             protected:
00149                 /**
00150                 * Default constructor.
00151                 */
00152                 NullMuterator();
00153 
00154 
00155             // ----- Iterator interface ---------------------------------
00156 
00157             public:
00158                 /**
00159                 * {@inheritDoc}
00160                 */
00161                 virtual bool hasNext() const;
00162 
00163                 /**
00164                 * {@inheritDoc}
00165                 */
00166                 virtual Object::Holder next();
00167 
00168                 /**
00169                 * {@inheritDoc}
00170                 */
00171                 virtual void remove();
00172 
00173             public:
00174                 static Handle getInstance();
00175             };
00176 
00177 
00178     // ----- Inner class: NullSet -------------------------------------------
00179     public:
00180         class COH_EXPORT NullSet
00181             : public cloneable_spec<NullSet,
00182                      extends<AbstractSet>,
00183                      implements<PortableObject> >
00184             {
00185             friend class factory<NullImplementation::NullSet>;
00186 
00187             // ----- constructors ---------------------------------------
00188 
00189             protected:
00190                 /**
00191                 * Default constructor (for PortableObject).
00192                 */
00193                 NullSet();
00194 
00195                 /**
00196                 * Copy constructor.
00197                 */
00198                 NullSet(const NullSet& that);
00199 
00200 
00201             // ----- Set interface --------------------------------------
00202 
00203             public:
00204 
00205                 /**
00206                 * {@inheritDoc}
00207                 */
00208                 virtual bool contains(Object::View v) const;
00209 
00210                 /**
00211                 * {@inheritDoc}
00212                 */
00213                 virtual Iterator::Handle iterator() const;
00214 
00215                 /**
00216                 * {@inheritDoc}
00217                 */
00218                 virtual Muterator::Handle iterator();
00219 
00220                 /**
00221                 * {@inheritDoc}
00222                 */
00223                 virtual ObjectArray::Handle toArray(
00224                         ObjectArray::Handle hao = NULL) const;
00225 
00226                 /**
00227                 * {@inheritDoc}
00228                 */
00229                 virtual bool add(Object::Holder oh);
00230 
00231                 /**
00232                 * {@inheritDoc}
00233                 */
00234                 virtual bool remove(Object::View v);
00235 
00236                 /**
00237                 * {@inheritDoc}
00238                 */
00239                 virtual bool containsAll(Collection::View vc) const;
00240 
00241                 /**
00242                 * {@inheritDoc}
00243                 */
00244                 virtual bool addAll(Collection::View vc);
00245 
00246                 /**
00247                 * {@inheritDoc}
00248                 */
00249                 virtual bool removeAll(Collection::View vc);
00250 
00251                 /**
00252                 * {@inheritDoc}
00253                 */
00254                 virtual bool retainAll(Collection::View vc);
00255 
00256                 /**
00257                 * {@inheritDoc}
00258                 */
00259                 virtual size32_t size() const;
00260 
00261                 /**
00262                 * {@inheritDoc}
00263                 */
00264                 virtual bool isEmpty() const;
00265 
00266                 /**
00267                 * {@inheritDoc}
00268                 */
00269                 virtual void clear();
00270 
00271 
00272             // ----- PortableObject interface ---------------------------
00273 
00274             public:
00275                 /**
00276                 * {@inheritDoc}
00277                 */
00278                 virtual void readExternal(PofReader::Handle hIn);
00279 
00280                 /**
00281                 * {@inheritDoc}
00282                 */
00283                 virtual void writeExternal(PofWriter::Handle hOut) const;
00284 
00285 
00286             // ----- Object interface -----------------------------------
00287 
00288             public:
00289                 /**
00290                 * {@inheritDoc}
00291                 */
00292           virtual bool equals(Object::View v) const;
00293 
00294             public:
00295                 static Handle getInstance();
00296             };
00297 
00298     // ----- Inner class: NullCollection ------------------------------------
00299     public:
00300         class COH_EXPORT NullCollection
00301             : public cloneable_spec<NullCollection,
00302                      extends<Object>,
00303                      implements<Collection, PortableObject> >
00304             {
00305             friend class factory<NullImplementation::NullCollection>;
00306 
00307             // ----- constructors ---------------------------------------
00308 
00309             protected:
00310                 /**
00311                 * Default constructor (for PortableObject).
00312                 */
00313                 NullCollection();
00314 
00315                 /**
00316                 * Copy constructor.
00317                 */
00318                 NullCollection(const NullCollection& that);
00319 
00320 
00321             // ----- Collection interface -------------------------------
00322 
00323             public:
00324                 /**
00325                 * {@inheritDoc}
00326                 */
00327                 virtual bool contains(Object::View v) const;
00328 
00329                 /**
00330                 * {@inheritDoc}
00331                 */
00332                 virtual Iterator::Handle iterator() const;
00333 
00334                 /**
00335                 * {@inheritDoc}
00336                 */
00337                 virtual Muterator::Handle iterator();
00338 
00339                 /**
00340                 * {@inheritDoc}
00341                 */
00342                 virtual ObjectArray::Handle toArray(
00343                         ObjectArray::Handle hoa = NULL) const;
00344 
00345                 /**
00346                 * {@inheritDoc}
00347                 */
00348                 virtual bool add(Object::Holder oh);
00349 
00350                 /**
00351                 * {@inheritDoc}
00352                 */
00353                 virtual bool remove(Object::View v);
00354 
00355                 /**
00356                 * {@inheritDoc}
00357                 */
00358                 virtual bool containsAll(Collection::View vc) const;
00359 
00360                 /**
00361                 * {@inheritDoc}
00362                 */
00363                 virtual bool addAll(Collection::View vc);
00364 
00365                 /**
00366                 * {@inheritDoc}
00367                 */
00368                 virtual bool removeAll(Collection::View vc);
00369 
00370                 /**
00371                 * {@inheritDoc}
00372                 */
00373                 virtual bool retainAll(Collection::View vc);
00374 
00375                 /**
00376                 * {@inheritDoc}
00377                 */
00378                 virtual size32_t size() const;
00379 
00380                 /**
00381                 * {@inheritDoc}
00382                 */
00383                 virtual bool isEmpty() const;
00384 
00385                 /**
00386                 * {@inheritDoc}
00387                 */
00388                 virtual void clear();
00389 
00390 
00391             // ----- PortableObject interface ---------------------------
00392 
00393             public:
00394                 /**
00395                 * {@inheritDoc}
00396                 */
00397                 virtual void readExternal(PofReader::Handle hIn);
00398 
00399                 /**
00400                 * {@inheritDoc}
00401                 */
00402                 virtual void writeExternal(PofWriter::Handle hOut) const;
00403 
00404 
00405             // ----- Object interface -----------------------------------
00406 
00407             public:
00408                 /**
00409                 * {@inheritDoc}
00410                 */
00411           virtual bool equals(Object::View v) const;
00412 
00413             public:
00414                 static Handle getInstance();
00415             };
00416 
00417     // ----- Inner class: NullMap --------------------------------------------
00418 
00419     public:
00420         class COH_EXPORT NullMap
00421             : public cloneable_spec<NullMap,
00422                      extends<Object>,
00423                      implements<Map, PortableObject> >
00424             {
00425             friend class factory<NullImplementation::NullMap>;
00426 
00427             // ----- constructors ---------------------------------------
00428 
00429             protected:
00430                 /**
00431                 * Default constructor (for PortableObject).
00432                 */
00433                 NullMap();
00434 
00435                 /**
00436                 * Copy constructor.
00437                 */
00438                 NullMap(const NullMap& that);
00439 
00440 
00441             // ----- Map interface ---------------------------------------
00442 
00443             public:
00444                 /**
00445                 * {@inheritDoc}
00446                 */
00447                 virtual size32_t size() const;
00448 
00449                 /**
00450                 * {@inheritDoc}
00451                 */
00452                 virtual bool isEmpty() const;
00453 
00454                 /**
00455                 * {@inheritDoc}
00456                 */
00457                 virtual void clear();
00458 
00459                 /**
00460                 * {@inheritDoc}
00461                 */
00462                 virtual bool containsKey(Object::View vKey) const;
00463 
00464                 /**
00465                 * {@inheritDoc}
00466                 */
00467                 virtual bool containsValue(Object::View vValue) const;
00468 
00469                 /**
00470                 * {@inheritDoc}
00471                 */
00472                 virtual Object::Holder get(Object::View vKey) const;
00473 
00474                 /**
00475                 * {@inheritDoc}
00476                 */
00477                 virtual Object::Holder get(Object::View vKey);
00478 
00479                 /**
00480                 * {@inheritDoc}
00481                 */
00482                 virtual Object::Holder put(Object::View vKey,
00483                         Object::Holder ohValue);
00484 
00485                 /**
00486                 * {@inheritDoc}
00487                 */
00488                 virtual Object::Holder remove(Object::View vKey);
00489                 using Map::remove;
00490 
00491                 /**
00492                 * {@inheritDoc}
00493                 */
00494                 virtual void putAll(Map::View vMap);
00495 
00496                 /**
00497                 * {@inheritDoc}
00498                 */
00499                 virtual Set::View keySet() const;
00500 
00501                 /**
00502                 * {@inheritDoc}
00503                 */
00504                 virtual Set::Handle keySet();
00505 
00506                 /**
00507                 * {@inheritDoc}
00508                 */
00509                 virtual Collection::View values() const;
00510 
00511                 /**
00512                 * {@inheritDoc}
00513                 */
00514                 virtual Collection::Handle values();
00515 
00516                 /**
00517                 * {@inheritDoc}
00518                 */
00519                 virtual Set::View entrySet() const;
00520 
00521                 /**
00522                 * {@inheritDoc}
00523                 */
00524                 virtual Set::Handle entrySet();
00525 
00526 
00527             // ----- PortableObject interface ---------------------------
00528 
00529             public:
00530                 /**
00531                 * {@inheritDoc}
00532                 */
00533                 virtual void readExternal(PofReader::Handle hIn);
00534 
00535                 /**
00536                 * {@inheritDoc}
00537                 */
00538                 virtual void writeExternal(PofWriter::Handle hOut) const;
00539 
00540 
00541             // ----- Object interface -----------------------------------
00542 
00543             public:
00544                 /**
00545                 * {@inheritDoc}
00546                 */
00547           virtual bool equals(Object::View v) const;
00548 
00549             public:
00550                 static Handle getInstance();
00551             };
00552 
00553 
00554     // ----- Inner class: NullObservableMap ---------------------------------
00555 
00556     public:
00557         class COH_EXPORT NullObservableMap
00558             : public cloneable_spec<NullObservableMap,
00559                      extends<NullMap>,
00560                      implements<ObservableMap> >
00561             {
00562             friend class factory<NullImplementation::NullObservableMap>;
00563 
00564             // ----- constructors ---------------------------------------
00565 
00566             protected:
00567                 /**
00568                 * Default constructor (for PortableObject).
00569                 */
00570                 NullObservableMap();
00571 
00572                 /**
00573                 * Copy constructor.
00574                 */
00575                 NullObservableMap(const NullObservableMap& that);
00576 
00577 
00578             // ----- ObservableMap interface ----------------------------
00579 
00580             public:
00581                 /**
00582                 * {@inheritDoc}
00583                 */
00584                 virtual void addKeyListener(MapListener::Handle hListener,
00585                         Object::View vKey, bool fLite);
00586 
00587                 /**
00588                 * {@inheritDoc}
00589                 */
00590                 virtual void removeKeyListener(MapListener::Handle hListener,
00591                         Object::View vKey);
00592 
00593                 /**
00594                 * {@inheritDoc}
00595                 */
00596                 virtual void addMapListener(MapListener::Handle hListener);
00597         
00598                 /**
00599                 * {@inheritDoc}
00600                 */
00601                 virtual void removeMapListener(MapListener::Handle hListener);
00602         
00603                 /**
00604                 * {@inheritDoc}
00605                 */
00606                 virtual void addFilterListener(MapListener::Handle hListener,
00607                         Filter::View vFilter, bool fLite);
00608 
00609                 /**
00610                 * {@inheritDoc}
00611                 */
00612                 virtual void removeFilterListener(MapListener::Handle hListener,
00613                         Filter::View vFilter);
00614 
00615             public:
00616                 static Handle getInstance();
00617             };
00618 
00619 
00620     // ----- Inner class: NullValueExtractor --------------------------------
00621 
00622     public:
00623         class COH_EXPORT NullValueExtractor
00624             : public class_spec<NullValueExtractor,
00625                      extends<Object>,
00626                      implements<ValueExtractor> >
00627             {
00628             friend class factory<NullImplementation::NullValueExtractor>;
00629 
00630             // ----- constructors ---------------------------------------
00631 
00632             protected:
00633                 /**
00634                 * Default constructor (for PortableObject).
00635                 */
00636                 NullValueExtractor();
00637 
00638 
00639             // ----- ValueExtractor interface ---------------------------
00640 
00641             public:
00642                 /**
00643                 * {@inheritDoc}
00644                 */
00645                 virtual Object::Holder extract(Object::Holder ohTarget) const;
00646 
00647 
00648             // ----- Object interface -----------------------------------
00649 
00650             public:
00651                 /**
00652                 * {@inheritDoc}
00653                 */
00654                 virtual bool equals(Object::View v) const;
00655 
00656                 /**
00657                 * {@inheritDoc}
00658                 */
00659                 virtual size32_t hashCode() const;
00660 
00661 
00662             // ----- PortableObject interface ---------------------------
00663 
00664             public:
00665                 /**
00666                 * {@inheritDoc}
00667                 */
00668                 virtual void readExternal(PofReader::Handle hIn);
00669 
00670                 /**
00671                 * {@inheritDoc}
00672                 */
00673                 virtual void writeExternal(PofWriter::Handle hOut) const;
00674 
00675             public:
00676                 static Handle getInstance();
00677             };
00678     };
00679 
00680 COH_CLOSE_NAMESPACE2
00681 
00682 #endif // COH_NULL_IMPLEMENTATION_HPP
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.