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

E26041-01

coherence/util/NullImplementation.hpp

00001 /*
00002 * NullImplementation.hpp
00003 *
00004 * Copyright (c) 2000, 2013, 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 
00490                 /**
00491                 * {@inheritDoc}
00492                 */
00493                 virtual void putAll(Map::View vMap);
00494 
00495                 /**
00496                 * {@inheritDoc}
00497                 */
00498                 virtual Set::View keySet() const;
00499 
00500                 /**
00501                 * {@inheritDoc}
00502                 */
00503                 virtual Set::Handle keySet();
00504 
00505                 /**
00506                 * {@inheritDoc}
00507                 */
00508                 virtual Collection::View values() const;
00509 
00510                 /**
00511                 * {@inheritDoc}
00512                 */
00513                 virtual Collection::Handle values();
00514 
00515                 /**
00516                 * {@inheritDoc}
00517                 */
00518                 virtual Set::View entrySet() const;
00519 
00520                 /**
00521                 * {@inheritDoc}
00522                 */
00523                 virtual Set::Handle entrySet();
00524 
00525 
00526             // ----- PortableObject interface ---------------------------
00527 
00528             public:
00529                 /**
00530                 * {@inheritDoc}
00531                 */
00532                 virtual void readExternal(PofReader::Handle hIn);
00533 
00534                 /**
00535                 * {@inheritDoc}
00536                 */
00537                 virtual void writeExternal(PofWriter::Handle hOut) const;
00538 
00539 
00540             // ----- Object interface -----------------------------------
00541 
00542             public:
00543                 /**
00544                 * {@inheritDoc}
00545                 */
00546           virtual bool equals(Object::View v) const;
00547 
00548             public:
00549                 static Handle getInstance();
00550             };
00551 
00552 
00553     // ----- Inner class: NullObservableMap ---------------------------------
00554 
00555     public:
00556         class COH_EXPORT NullObservableMap
00557             : public cloneable_spec<NullObservableMap,
00558                      extends<NullMap>,
00559                      implements<ObservableMap> >
00560             {
00561             friend class factory<NullImplementation::NullObservableMap>;
00562 
00563             // ----- constructors ---------------------------------------
00564 
00565             protected:
00566                 /**
00567                 * Default constructor (for PortableObject).
00568                 */
00569                 NullObservableMap();
00570 
00571                 /**
00572                 * Copy constructor.
00573                 */
00574                 NullObservableMap(const NullObservableMap& that);
00575 
00576 
00577             // ----- ObservableMap interface ----------------------------
00578 
00579             public:
00580                 /**
00581                 * {@inheritDoc}
00582                 */
00583                 virtual void addKeyListener(MapListener::Handle hListener,
00584                         Object::View vKey, bool fLite);
00585 
00586                 /**
00587                 * {@inheritDoc}
00588                 */
00589                 virtual void removeKeyListener(MapListener::Handle hListener,
00590                         Object::View vKey);
00591 
00592                 /**
00593                 * {@inheritDoc}
00594                 */
00595                 virtual void addFilterListener(MapListener::Handle hListener,
00596                         Filter::View vFilter, bool fLite);
00597 
00598                 /**
00599                 * {@inheritDoc}
00600                 */
00601                 virtual void removeFilterListener(MapListener::Handle hListener,
00602                         Filter::View vFilter);
00603 
00604             public:
00605                 static Handle getInstance();
00606             };
00607 
00608 
00609     // ----- Inner class: NullValueExtractor --------------------------------
00610 
00611     public:
00612         class COH_EXPORT NullValueExtractor
00613             : public class_spec<NullValueExtractor,
00614                      extends<Object>,
00615                      implements<ValueExtractor> >
00616             {
00617             friend class factory<NullImplementation::NullValueExtractor>;
00618 
00619             // ----- constructors ---------------------------------------
00620 
00621             protected:
00622                 /**
00623                 * Default constructor (for PortableObject).
00624                 */
00625                 NullValueExtractor();
00626 
00627 
00628             // ----- ValueExtractor interface ---------------------------
00629 
00630             public:
00631                 /**
00632                 * {@inheritDoc}
00633                 */
00634                 virtual Object::Holder extract(Object::Holder ohTarget) const;
00635 
00636 
00637             // ----- Object interface -----------------------------------
00638 
00639             public:
00640                 /**
00641                 * {@inheritDoc}
00642                 */
00643                 virtual bool equals(Object::View v) const;
00644 
00645                 /**
00646                 * {@inheritDoc}
00647                 */
00648                 virtual size32_t hashCode() const;
00649 
00650 
00651             // ----- PortableObject interface ---------------------------
00652 
00653             public:
00654                 /**
00655                 * {@inheritDoc}
00656                 */
00657                 virtual void readExternal(PofReader::Handle hIn);
00658 
00659                 /**
00660                 * {@inheritDoc}
00661                 */
00662                 virtual void writeExternal(PofWriter::Handle hOut) const;
00663 
00664             public:
00665                 static Handle getInstance();
00666             };
00667     };
00668 
00669 COH_CLOSE_NAMESPACE2
00670 
00671 #endif // COH_NULL_IMPLEMENTATION_HPP
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.