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

F79659-03

coherence/util/WrapperCollections.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_WRAPPER_COLLECTIONS_HPP
00008 #define COH_WRAPPER_COLLECTIONS_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/util/Collection.hpp"
00013 #include "coherence/util/Iterator.hpp"
00014 #include "coherence/util/List.hpp"
00015 #include "coherence/util/ListIterator.hpp"
00016 #include "coherence/util/Map.hpp"
00017 #include "coherence/util/Muterator.hpp"
00018 #include "coherence/util/Set.hpp"
00019 
00020 #include <cstddef>
00021 
00022 
00023 COH_OPEN_NAMESPACE2(coherence,util)
00024 
00025 
00026 /**
00027 * A collection of abstract Collection implementation classes for wrapping
00028 * Collection types.
00029 *
00030 * @author mf  2007.07.05
00031 */
00032 class COH_EXPORT WrapperCollections
00033     {
00034     // ----- inner classes --------------------------------------------------
00035 
00036     public:
00037         /**
00038         * Iterator implementation which delegates all calls to another
00039         * Iterator.
00040         */
00041         class COH_EXPORT AbstractWrapperIterator
00042             : public abstract_spec<AbstractWrapperIterator,
00043                 extends<Object>,
00044                 implements<Muterator> >
00045             {
00046             // ----- constructors ---------------------------------------
00047 
00048             protected:
00049                 /**
00050                 * Create an AbstractWrapperIterator which delegates to the
00051                 * specified Iterator.
00052                 *
00053                 * @param hiterDelegate a handle to the specified delegate
00054                 *        Iterator
00055                 */
00056                 AbstractWrapperIterator(Iterator::Handle hiterDelegate);
00057 
00058                 /**
00059                 * Copy constructor.
00060                 */
00061                 AbstractWrapperIterator(const AbstractWrapperIterator& that);
00062 
00063 
00064             // ----- Iterator interface ---------------------------------
00065 
00066             public:
00067                 /**
00068                 * {@inheritDoc}
00069                 */
00070                 virtual bool hasNext() const;
00071 
00072                 /**
00073                 * {@inheritDoc}
00074                 */
00075                 virtual Object::Holder next();
00076 
00077 
00078             // ----- Muterator interface --------------------------------
00079 
00080             public:
00081                 /**
00082                 * {@inheritDoc}
00083                 */
00084                 virtual void remove();
00085 
00086             // ----- Object interface -----------------------------------
00087 
00088             public:
00089                 /**
00090                 * {@inheritDoc}
00091                 */
00092                 virtual TypedHandle<const String> toString() const;
00093 
00094                 /**
00095                 * {@inheritDoc}
00096                 */
00097                 virtual size32_t hashCode() const;
00098 
00099                 /**
00100                 * {@inheritDoc}
00101                 */
00102                 virtual bool equals(Object::View v) const;
00103 
00104 
00105             // ----- accessors ------------------------------------------
00106 
00107             protected:
00108                 /**
00109                 * Return a handle to the delegate.
00110                 *
00111                 * @return the delegate handle
00112                 *
00113                 * @throw UnsupportedOperationException if the delegate is a
00114                 *        view
00115                 */
00116                 virtual Iterator::Handle getDelegate();
00117 
00118                 /**
00119                 * Return a view to the delegate.
00120                 *
00121                 * @return the delegate view
00122                 */
00123                 virtual Iterator::View getDelegate() const;
00124 
00125             // ----- data members ---------------------------------------
00126 
00127             private:
00128                 /**
00129                 * The Iterator to which this wrapper delegates.
00130                 */
00131                 FinalHolder<Iterator> f_ohDelegate;
00132             };
00133 
00134 
00135         /**
00136         * ListIterator implementation which delegates all calls to another
00137         * ListIterator.
00138         */
00139         class COH_EXPORT AbstractWrapperListIterator
00140             : public abstract_spec<AbstractWrapperListIterator,
00141                 extends<AbstractWrapperIterator>,
00142                 implements<ListMuterator> >
00143             {
00144             // ----- constructors ---------------------------------------
00145 
00146             protected:
00147                 /**
00148                 * Create an AbstractWrapperListIterator which delegates to
00149                 * the specified ListIterator.
00150                 *
00151                 * @param hIterDelegate  the Iterator to delegate to
00152                 */
00153                 AbstractWrapperListIterator(
00154                         ListIterator::Handle hIterDelegate);
00155 
00156                 /**
00157                 * Copy constructor.
00158                 */
00159                 AbstractWrapperListIterator(
00160                         const AbstractWrapperListIterator& that);
00161 
00162             // ----- ListIterator interface ----------------------------
00163 
00164             public:
00165                 /**
00166                 * {@inheritDoc}
00167                 */
00168                 virtual bool hasPrevious() const;
00169 
00170                 /**
00171                 * {@inheritDoc}
00172                 */
00173                 virtual Object::Holder previous();
00174 
00175                 /**
00176                 * {@inheritDoc}
00177                 */
00178                 virtual size32_t nextIndex() const;
00179 
00180                 /**
00181                 * {@inheritDoc}
00182                 */
00183                 virtual size32_t previousIndex() const;
00184 
00185             // ----- ListMuterator interface ----------------------------
00186 
00187             public:
00188                 /**
00189                 * {@inheritDoc}
00190                 */
00191                 virtual void remove();
00192                 /**
00193                 * {@inheritDoc}
00194                 */
00195                 virtual void add(Object::Holder oh);
00196 
00197                 /**
00198                 * {@inheritDoc}
00199                 */
00200                 virtual void set(Object::Holder oh);
00201 
00202             // ----- Iterator interface ---------------------------------
00203 
00204             public:
00205                 /**
00206                 * {@inheritDoc}
00207                 */
00208                 virtual bool hasNext() const;
00209 
00210                 /**
00211                 * {@inheritDoc}
00212                 */
00213                 virtual Object::Holder next();
00214 
00215 
00216             // ----- helper methods -------------------------------------
00217 
00218             protected:
00219                 /**
00220                 * Return a handle to the delegate.
00221                 *
00222                 * @return the delegate handle
00223                 *
00224                 * @throw UnsupportedOperationException if the delegate is a
00225                 *        view
00226                 */
00227                 virtual ListIterator::Handle getListDelegate();
00228 
00229                 /**
00230                 * Return a view to the delegate.
00231                 *
00232                 * @return the delegate view
00233                 */
00234                 virtual ListIterator::View getListDelegate() const;
00235 
00236 
00237             // ----- data members -------------------------------------------
00238 
00239             private:
00240                 /**
00241                 * The ListIterator to which this wrapper delegates.
00242                 */
00243                 FinalHolder<ListIterator> f_ohDelegate;
00244             };
00245 
00246 
00247         /**
00248         * Collection implementation which delegates all calls to another
00249         * Collection.
00250         */
00251         class COH_EXPORT AbstractWrapperCollection
00252             : public abstract_spec<AbstractWrapperCollection,
00253                 extends<Object>,
00254                 implements<Collection> >
00255             {
00256             // ----- constructors ---------------------------------------
00257 
00258             protected:
00259                 /**
00260                 * Create an AbstractWrapperCollection which delegates to the
00261                 * specified Collection.
00262                 *
00263                 * @param ohCollDelegate  the Collection to delegate to
00264                 */
00265                 AbstractWrapperCollection(Collection::Holder ohCollDelegate);
00266 
00267                 /**
00268                 * Copy constructor.
00269                 */
00270                 AbstractWrapperCollection(const AbstractWrapperCollection& that);
00271 
00272             // ----- Collection interface -------------------------------
00273 
00274             public:
00275                 /**
00276                 * {@inheritDoc}
00277                 */
00278                 virtual size32_t size() const;
00279 
00280                 /**
00281                 * {@inheritDoc}
00282                 */
00283                 virtual bool isEmpty() const;
00284 
00285                 /**
00286                 * {@inheritDoc}
00287                 */
00288                 virtual bool contains(Object::View v) const;
00289 
00290                 /**
00291                 * {@inheritDoc}
00292                 */
00293                 virtual Iterator::Handle iterator() const;
00294 
00295                 /**
00296                 * {@inheritDoc}
00297                 */
00298                 virtual Muterator::Handle iterator();
00299 
00300                 /**
00301                 * {@inheritDoc}
00302                 */
00303                 virtual ObjectArray::Handle toArray(
00304                         ObjectArray::Handle hao = NULL) const;
00305 
00306                 /**
00307                 * {@inheritDoc}
00308                 */
00309                 virtual bool add(Object::Holder oh);
00310 
00311                 /**
00312                 * {@inheritDoc}
00313                 */
00314                 virtual bool remove(Object::View v);
00315 
00316                 /**
00317                 * {@inheritDoc}
00318                 */
00319                 virtual bool containsAll(Collection::View vc) const;
00320 
00321                 /**
00322                 * {@inheritDoc}
00323                 */
00324                 virtual bool addAll(Collection::View vc);
00325 
00326                 /**
00327                 * {@inheritDoc}
00328                 */
00329                 virtual bool removeAll(Collection::View vc);
00330 
00331                 /**
00332                 * {@inheritDoc}
00333                 */
00334                 virtual bool retainAll(Collection::View vc);
00335 
00336                 /**
00337                 * {@inheritDoc}
00338                 */
00339                 virtual void clear();
00340 
00341             // ----- Object interface -----------------------------------
00342 
00343             public:
00344                 /**
00345                 * {@inheritDoc}
00346                 */
00347                 virtual TypedHandle<const String> toString() const;
00348 
00349                 /**
00350                 * {@inheritDoc}
00351                 */
00352                 virtual size32_t hashCode() const;
00353 
00354                 /**
00355                 * {@inheritDoc}
00356                 */
00357                 virtual bool equals(Object::View v) const;
00358 
00359                 /**
00360                 * {@inheritDoc}
00361                 */
00362                 virtual bool isImmutable() const;
00363 
00364             // ----- accessors ------------------------------------------
00365 
00366             protected:
00367                 /**
00368                 * Return a handle to the delegate.
00369                 *
00370                 * @return the delegate handle
00371                 *
00372                 * @throw UnsupportedOperationException if the delegate is a
00373                 *        view
00374                 */
00375                 virtual Collection::Handle getDelegate();
00376 
00377                 /**
00378                 * Return a view to the delegate.
00379                 *
00380                 * @return the delegate view
00381                 */
00382                 virtual Collection::View getDelegate() const;
00383 
00384             // ----- data members ---------------------------------------
00385 
00386             private:
00387                 /**
00388                 * The Collection to which this wrapper delegates.
00389                 */
00390                 FinalHolder<Collection> f_ohDelegate;
00391             };
00392 
00393         /**
00394         * Set implementation which delegates all calls to another Set.
00395         */
00396         class COH_EXPORT AbstractWrapperSet
00397             : public abstract_spec<AbstractWrapperSet,
00398                 extends<Object>,
00399                 implements<Set> >
00400             {
00401             // ----- constructors ---------------------------------------
00402 
00403             protected:
00404                 /**
00405                 * Create an AbstractWrapperSet which delegates to the
00406                 * specified Set.
00407                 *
00408                 * @param ohSetDelegate  the Set to delegate to
00409                 */
00410                 AbstractWrapperSet(Set::Holder ohSetDelegate);
00411 
00412                 /**
00413                 * Copy constructor.
00414                 */
00415                 AbstractWrapperSet(const AbstractWrapperSet& that);
00416 
00417             // ----- Set interface --------------------------------------
00418 
00419             public:
00420                 /**
00421                 * {@inheritDoc}
00422                 */
00423                 virtual size32_t size() const;
00424 
00425                 /**
00426                 * {@inheritDoc}
00427                 */
00428                 virtual bool isEmpty() const;
00429 
00430                 /**
00431                 * {@inheritDoc}
00432                 */
00433                 virtual bool contains(Object::View v) const;
00434 
00435                 /**
00436                 * {@inheritDoc}
00437                 */
00438                 virtual Iterator::Handle iterator() const;
00439 
00440                 /**
00441                 * {@inheritDoc}
00442                 */
00443                 virtual Muterator::Handle iterator();
00444 
00445                 /**
00446                 * {@inheritDoc}
00447                 */
00448                 virtual ObjectArray::Handle toArray(
00449                         ObjectArray::Handle hao = NULL) const;
00450 
00451                 /**
00452                 * {@inheritDoc}
00453                 */
00454                 virtual bool add(Object::Holder oh);
00455 
00456                 /**
00457                 * {@inheritDoc}
00458                 */
00459                 virtual bool remove(Object::View v);
00460 
00461                 /**
00462                 * {@inheritDoc}
00463                 */
00464                 virtual bool containsAll(Collection::View vc) const;
00465 
00466                 /**
00467                 * {@inheritDoc}
00468                 */
00469                 virtual bool addAll(Collection::View vc);
00470 
00471                 /**
00472                 * {@inheritDoc}
00473                 */
00474                 virtual bool removeAll(Collection::View vc);
00475 
00476                 /**
00477                 * {@inheritDoc}
00478                 */
00479                 virtual bool retainAll(Collection::View vc);
00480 
00481                 /**
00482                 * {@inheritDoc}
00483                 */
00484                 virtual void clear();
00485 
00486             // ----- Object interface -----------------------------------
00487 
00488             public:
00489                 /**
00490                 * {@inheritDoc}
00491                 */
00492                 virtual TypedHandle<const String> toString() const;
00493 
00494                 /**
00495                 * {@inheritDoc}
00496                 */
00497                 virtual size32_t hashCode() const;
00498 
00499                 /**
00500                 * {@inheritDoc}
00501                 */
00502                 virtual bool equals(Object::View v) const;
00503 
00504                 /**
00505                 * {@inheritDoc}
00506                 */
00507                 virtual bool isImmutable() const;
00508 
00509             // ----- accessors ------------------------------------------
00510 
00511             protected:
00512                 /**
00513                 * Return a handle to the delegate.
00514                 *
00515                 * @return the delegate handle
00516                 *
00517                 * @throw UnsupportedOperationException if the delegate is a
00518                 *        view
00519                 */
00520                 virtual Set::Handle getDelegate();
00521 
00522                 /**
00523                 * Return a view to the delegate.
00524                 *
00525                 * @return the delegate view
00526                 */
00527                 virtual Set::View getDelegate() const;
00528 
00529             // ----- data members ---------------------------------------
00530 
00531             private:
00532                 /**
00533                 * The Set to which this wrapper delegates.
00534                 */
00535                 FinalHolder<Set> f_ohDelegate;
00536             };
00537 
00538 
00539         /**
00540         * List implementation which delegates all calls to another List.
00541         */
00542         class COH_EXPORT AbstractWrapperList
00543             : public abstract_spec<AbstractWrapperList,
00544                 extends<Object>,
00545                 implements<List> >
00546             {
00547             // ----- constructors -------------------------------------------
00548 
00549             protected:
00550                 /**
00551                 * Create an AbstractWrapperList which delegates to the
00552                 * specified List.
00553                 *
00554                 * @param ohListDelegate  the List to delegate to
00555                 */
00556                 AbstractWrapperList(List::Holder ohListDelegate);
00557 
00558                 /**
00559                 * Copy constructor.
00560                 */
00561                 AbstractWrapperList(const AbstractWrapperList& that);
00562 
00563 
00564             // ----- List interface ------------------------------------------
00565 
00566             public:
00567                 /**
00568                 * {@inheritDoc}
00569                 */
00570                 virtual bool add(size32_t i, Object::Holder oh);
00571 
00572                 /**
00573                 * {@inheritDoc}
00574                 */
00575                 virtual bool addAll(size32_t i, Collection::View vc);
00576 
00577                 /**
00578                 * {@inheritDoc}
00579                 */
00580                 virtual Object::Holder get(size32_t i) const;
00581 
00582                 /**
00583                 * {@inheritDoc}
00584                 */
00585                 virtual Object::Holder get(size32_t i);
00586 
00587                 /**
00588                 * {@inheritDoc}
00589                 */
00590                 virtual size32_t indexOf(Object::View v) const;
00591 
00592                 /**
00593                 * {@inheritDoc}
00594                 */
00595                 virtual size32_t lastIndexOf(Object::View v) const;
00596 
00597                 /**
00598                 * {@inheritDoc}
00599                 */
00600                 virtual ListIterator::Handle listIterator() const;
00601 
00602                 /**
00603                 * {@inheritDoc}
00604                 */
00605                 virtual ListIterator::Handle listIterator(size32_t index) const;
00606 
00607                 /**
00608                 * {@inheritDoc}
00609                 */
00610                 virtual ListMuterator::Handle listIterator();
00611 
00612                 /**
00613                 * {@inheritDoc}
00614                 */
00615                 virtual ListMuterator::Handle listIterator(size32_t index);
00616 
00617                 /**
00618                 * {@inheritDoc}
00619                 */
00620                 virtual Object::Holder remove(size32_t idx);
00621 
00622                 /**
00623                 * {@inheritDoc}
00624                 */
00625                 virtual Object::Holder set(size32_t idx, Object::Holder oh);
00626 
00627                 /**
00628                 * {@inheritDoc}
00629                 */
00630                 virtual List::Handle subList(size32_t fromIndex,
00631                         size32_t toIndex);
00632 
00633                 /**
00634                 * {@inheritDoc}
00635                 */
00636                 virtual List::View subList(size32_t fromIndex,
00637                         size32_t toIndex) const;
00638 
00639 
00640             // ----- Collection interface -----------------------------------
00641 
00642             public:
00643                 /**
00644                 * {@inheritDoc}
00645                 */
00646                 virtual size32_t size() const;
00647 
00648                 /**
00649                 * {@inheritDoc}
00650                 */
00651                 virtual bool isEmpty() const;
00652 
00653                 /**
00654                 * {@inheritDoc}
00655                 */
00656                 virtual bool contains(Object::View v) const;
00657 
00658                 /**
00659                 * {@inheritDoc}
00660                 */
00661                 virtual bool containsAll(Collection::View vCol) const;
00662 
00663                 /**
00664                 * {@inheritDoc}
00665                 */
00666                 virtual Iterator::Handle iterator() const;
00667 
00668                 /**
00669                 * {@inheritDoc}
00670                 */
00671                 virtual Muterator::Handle iterator();
00672 
00673                 /**
00674                 * {@inheritDoc}
00675                 */
00676                 virtual ObjectArray::Handle toArray(
00677                         ObjectArray::Handle hao = NULL) const;
00678 
00679                 /**
00680                 * {@inheritDoc}
00681                 */
00682                 virtual bool add(Object::Holder oh);
00683 
00684                 /**
00685                 * {@inheritDoc}
00686                 */
00687                 virtual bool addAll(Collection::View vCol);
00688 
00689                 /**
00690                 * {@inheritDoc}
00691                 */
00692                 virtual bool remove(Object::View v);
00693 
00694                 /**
00695                 * {@inheritDoc}
00696                 */
00697                 virtual bool removeAll(Collection::View vCol);
00698 
00699                 /**
00700                 * {@inheritDoc}
00701                 */
00702                 virtual bool retainAll(Collection::View vCol);
00703 
00704                 /**
00705                 * {@inheritDoc}
00706                 */
00707                 virtual void clear();
00708 
00709 
00710             // ----- Object interface ---------------------------------------
00711 
00712             public:
00713                 /**
00714                 * {@inheritDoc}
00715                 */
00716                 virtual TypedHandle<const String> toString() const;
00717 
00718                 /**
00719                 * {@inheritDoc}
00720                 */
00721                 virtual size32_t hashCode() const;
00722 
00723                 /**
00724                 * {@inheritDoc}
00725                 */
00726                 virtual bool equals(Object::View v) const;
00727 
00728                 /**
00729                 * {@inheritDoc}
00730                 */
00731                 virtual bool isImmutable() const;
00732 
00733 
00734             // ----- helper methods -----------------------------------------
00735 
00736             protected:
00737                 /**
00738                 * Return a handle to the delegate.
00739                 *
00740                 * @return the delegate handle
00741                 *
00742                 * @throw UnsupportedOperationException if the delegate is a
00743                 *        view
00744                 */
00745                 virtual List::Handle getDelegate();
00746 
00747                 /**
00748                 * Return a view to the delegate.
00749                 *
00750                 * @return the delegate view
00751                 */
00752                 virtual List::View getDelegate() const;
00753 
00754 
00755             // ----- data members -------------------------------------------
00756 
00757             private:
00758                 /**
00759                 * The List to which this wrapper delegates.
00760                 */
00761                 FinalHolder<List> f_ohDelegate;
00762             };
00763 
00764         /**
00765         * Map implementation which delegates all calls to another Map.
00766         */
00767         class COH_EXPORT AbstractWrapperMap
00768             : public abstract_spec<AbstractWrapperMap,
00769                 extends<Object>,
00770                 implements<Map> >
00771             {
00772             // ----- constructors ---------------------------------------
00773 
00774             protected:
00775                 /**
00776                 * Create an AbstractWrapperMap which delegates to the
00777                 * specified Map.
00778                 *
00779                 * @param ohMapDelegate  the Map to delegate to
00780                 */
00781                 AbstractWrapperMap(Map::Holder ohMapDelegate);
00782 
00783                 /**
00784                 * Copy constructor.
00785                 */
00786                 AbstractWrapperMap(const AbstractWrapperMap& that);
00787 
00788             // ----- Map interface --------------------------------------
00789 
00790             public:
00791                 /**
00792                 * {@inheritDoc}
00793                 */
00794                 virtual size32_t size() const;
00795 
00796                 /**
00797                 * {@inheritDoc}
00798                 */
00799                 virtual bool isEmpty() const;
00800 
00801                 /**
00802                 * {@inheritDoc}
00803                 */
00804                 virtual bool containsKey(Object::View vKey) const;
00805 
00806                 /**
00807                 * {@inheritDoc}
00808                 */
00809                 virtual bool containsValue(Object::View vValue) const;
00810 
00811                 /**
00812                 * {@inheritDoc}
00813                 */
00814                 virtual Object::Holder get(Object::View vKey) const;
00815 
00816                 /**
00817                 * {@inheritDoc}
00818                 */
00819                 virtual Object::Holder get(Object::View vKey);
00820 
00821                 /**
00822                 * {@inheritDoc}
00823                 */
00824                 virtual Object::Holder put(Object::View vKey,
00825                                          Object::Holder ohValue);
00826 
00827                 /**
00828                 * {@inheritDoc}
00829                 */
00830                 virtual Object::Holder remove(Object::View vKey);
00831                 using Map::remove;
00832 
00833                 /**
00834                 * {@inheritDoc}
00835                 */
00836                 virtual void putAll(Map::View vMap);
00837 
00838                 /**
00839                 * {@inheritDoc}
00840                 */
00841                 virtual void clear();
00842 
00843                 /**
00844                 * {@inheritDoc}
00845                 */
00846                 virtual Set::View keySet() const;
00847 
00848                 /**
00849                 * {@inheritDoc}
00850                 */
00851                 virtual Set::Handle keySet();
00852 
00853                 /**
00854                 * {@inheritDoc}
00855                 */
00856                 virtual Collection::View values() const;
00857 
00858                 /**
00859                 * {@inheritDoc}
00860                 */
00861                 virtual Collection::Handle values();
00862 
00863                 /**
00864                 * {@inheritDoc}
00865                 */
00866                 virtual Set::View entrySet() const;
00867 
00868                 /**
00869                 * {@inheritDoc}
00870                 */
00871                 virtual Set::Handle entrySet();
00872 
00873             // ----- Object interface -----------------------------------
00874 
00875             public:
00876                 /**
00877                 * {@inheritDoc}
00878                 */
00879                 virtual TypedHandle<const String> toString() const;
00880 
00881                 /**
00882                 * {@inheritDoc}
00883                 */
00884                 virtual size32_t hashCode() const;
00885 
00886                 /**
00887                 * {@inheritDoc}
00888                 */
00889                 virtual bool equals(Object::View v) const;
00890 
00891                 /**
00892                 * {@inheritDoc}
00893                 */
00894                 virtual bool isImmutable() const;
00895 
00896             // ----- accessors ------------------------------------------
00897 
00898             protected:
00899                 /**
00900                 * Return a handle to the delegate.
00901                 *
00902                 * @return the delegate handle
00903                 *
00904                 * @throw UnsupportedOperationException if the delegate is a
00905                 *        view
00906                 */
00907                 virtual Map::Handle getDelegate();
00908 
00909                 /**
00910                 * Return a view to the delegate.
00911                 *
00912                 * @return the delegate view
00913                 */
00914                 virtual Map::View getDelegate() const;
00915 
00916             // ----- data members ---------------------------------------
00917 
00918             private:
00919                 /**
00920                 * The Map to which this wrapper delegates.
00921                 */
00922                 FinalHolder<Map> f_ohDelegate;
00923             };
00924 
00925 
00926     // ----- inner class: AbstractWrapperEntry ------------------------------
00927 
00928     public:
00929         /**
00930         * Map#Entry implementation which delegates all calls to another
00931         * Map#Entry.
00932         */
00933         class COH_EXPORT AbstractWrapperEntry
00934             : public abstract_spec<AbstractWrapperEntry,
00935                 extends<Object>,
00936                 implements<Map::Entry> >
00937             {
00938             // ----- constructors ---------------------------------------
00939 
00940             protected:
00941                 /**
00942                 * Create an AbstractWrapperEntry which delegates to the
00943                 * specified Map#Entry.
00944                 *
00945                 * @param ohEntryDelegate  the Entry to delegate to
00946                 */
00947                 AbstractWrapperEntry(Map::Entry::Holder ohEntryDelegate);
00948 
00949                 /**
00950                 * Copy constructor.
00951                 */
00952                 AbstractWrapperEntry(const AbstractWrapperEntry& that);
00953 
00954             // ----- Map::Entry interface -------------------------------
00955 
00956             public:
00957                 /**
00958                 * {@inheritDoc}
00959                 */
00960                 virtual Object::View getKey() const;
00961 
00962                 /**
00963                 * {@inheritDoc}
00964                 */
00965                 virtual Object::Holder getValue() const;
00966 
00967                 /**
00968                 * {@inheritDoc}
00969                 */
00970                 virtual Object::Holder getValue();
00971 
00972                 /**
00973                 * {@inheritDoc}
00974                 */
00975                 virtual Object::Holder setValue(Object::Holder ohValue);
00976 
00977             // ----- Object interface -----------------------------------
00978 
00979             public:
00980                 /**
00981                 * {@inheritDoc}
00982                 */
00983                 virtual TypedHandle<const String> toString() const;
00984 
00985                 /**
00986                 * {@inheritDoc}
00987                 */
00988                 virtual size32_t hashCode() const;
00989 
00990                 /**
00991                 * {@inheritDoc}
00992                 */
00993                 virtual bool equals(Object::View v) const;
00994 
00995                 /**
00996                 * {@inheritDoc}
00997                 */
00998                 virtual bool isImmutable() const;
00999 
01000             // ----- accessors ------------------------------------------
01001 
01002             protected:
01003                 /**
01004                 * Return a handle to the delegate.
01005                 *
01006                 * @return the delegate handle
01007                 *
01008                 * @throw UnsupportedOperationException if the delegate is a
01009                 *        view
01010                 */
01011                 virtual Map::Entry::Handle getDelegate();
01012 
01013                 /**
01014                 * Return a view to the delegate.
01015                 *
01016                 * @return the delegate view
01017                 */
01018                 virtual Map::Entry::View getDelegate() const;
01019 
01020             // ----- data members ---------------------------------------
01021 
01022             private:
01023                 /**
01024                 * The Map::Entry to which this wrapper delegates.
01025                 */
01026                 FinalHolder<Map::Entry> f_ohDelegate;
01027             };
01028     };
01029 
01030 COH_CLOSE_NAMESPACE2
01031 
01032 #endif // COH_WRAPPER_COLLECTIONS_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.