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

E80355-01

coherence/util/extractor/PofUpdater.hpp

00001 /*
00002 * PofUpdater.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_POF_UPDATER_HPP
00017 #define COH_POF_UPDATER_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/io/pof/reflect/PofNavigator.hpp"
00025 #include "coherence/util/ValueUpdater.hpp"
00026 
00027 COH_OPEN_NAMESPACE3(coherence,util,extractor)
00028 
00029 using coherence::io::pof::PortableObject;
00030 using coherence::io::pof::PofReader;
00031 using coherence::io::pof::PofWriter;
00032 using coherence::io::pof::reflect::PofNavigator;
00033 
00034 
00035 /**
00036 * POF-based ValueUpdater implementation.
00037 *
00038 * @author as/gm  2009.04.02
00039 *
00040 * @since Coherence 3.5
00041 */
00042 class COH_EXPORT PofUpdater
00043     : public class_spec<PofUpdater,
00044         extends<Object>,
00045         implements<ValueUpdater, PortableObject> >
00046     {
00047     friend class factory<PofUpdater>;
00048 
00049     // ----- constructors ---------------------------------------------------
00050 
00051     protected:
00052         /**
00053         * Default constructor (for backward compatibility).
00054         */
00055         PofUpdater();
00056 
00057         /**
00058         * Constructs a PofUpdater based on a property index.
00059         * <p/>
00060         * This constructor is equivalent to:
00061         * <pre>
00062         *   PofUpdater::View vUpdater =
00063         *       PofUpdater::create(SimplePofPath::create(iProp));
00064         * </pre>
00065         *
00066         * @param iProp  property index
00067         */
00068         PofUpdater(int32_t iProp);
00069 
00070         /**
00071         * Constructs a PofUpdater based on a property path.
00072         *
00073         * @param vNavigator  POF navigator
00074         */
00075         PofUpdater(PofNavigator::View vNavigator);
00076 
00077 
00078    // ----- ValueUpdater interface ------------------------------------------
00079 
00080     public:
00081         /**
00082         * Update the passed target object using the specified value.
00083         * <p/>
00084         * It is expected that this updater will only be used against
00085         * POF-encoded entries implementing {@link BinaryEntry} interface.
00086         *
00087         * @param hTarget  the Object to update
00088         * @param ohValue  the new value to update the target's property with
00089         *
00090         * @throws UnsupportedOperationException  if the specified target
00091         *         object is not a POF-encoded {@link BinaryEntry} or the
00092         *         serializer is not a PofContext
00093         * @throws NullPointerException if the property cannot be resolved
00094         */
00095         virtual void update(Object::Handle hTarget,
00096                 Object::Holder ohValue) const;
00097 
00098 
00099     // ----- PortableObject interface ---------------------------------------
00100 
00101     public:
00102         /**
00103         * {@inheritDoc}
00104         */
00105         virtual void readExternal(PofReader::Handle hIn);
00106 
00107         /**
00108         * {@inheritDoc}
00109         */
00110         virtual void writeExternal(PofWriter::Handle hOut) const;
00111 
00112 
00113     // ----- Object interface -----------------------------------------------
00114 
00115     public:
00116         /**
00117         * Compare the PofUpdater with another object to determine
00118         * equality.
00119         *
00120         * @return true iff this PofUpdater and the passed object are
00121         *         equivalent PofUpdaters
00122         */
00123         virtual bool equals(Object::View v) const;
00124 
00125         /**
00126         * Determine a hash value for the PofUpdater object according to
00127         * the general {@link Object#hashCode()} contract.
00128         *
00129         * @return an integer hash value for this PofUpdater object
00130         */
00131         virtual size32_t hashCode() const;
00132 
00133         /**
00134         * Return a human-readable description for this PofUpdater.
00135         *
00136         * @return a String description of the PofUpdater
00137         */
00138         virtual TypedHandle<const String> toString() const;
00139 
00140 
00141     // ----- data members ---------------------------------------------------
00142 
00143     private:
00144         /**
00145         * POF navigator.
00146         */
00147         FinalView<PofNavigator> f_vNavigator;
00148     };
00149 
00150 COH_CLOSE_NAMESPACE3
00151 
00152 #endif // #define COH_POF_UPDATER_HPP
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.