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_ABSTRACT_UPDATER_HPP 00008 #define COH_ABSTRACT_UPDATER_HPP 00009 00010 #include "coherence/lang.ns" 00011 00012 #include "coherence/util/InvocableMap.hpp" 00013 #include "coherence/util/ValueUpdater.hpp" 00014 00015 COH_OPEN_NAMESPACE3(coherence,util,extractor) 00016 00017 00018 /** 00019 * Abstract base for ValueUpdater implementations. 00020 * <p/> 00021 * Starting with Coherence 3.6, when used to update information stored in a Map, 00022 * subclasses have the additional ability to operate against the Map::Entry 00023 * instead of just the value. This allows an updater implementation to update a 00024 * desired value using all available information on the corresponding Map::Entry 00025 * object and is intended to be used in advanced custom scenarios, when 00026 * application code needs to look at both key and value at the same time or can 00027 * make some very specific assumptions regarding to the implementation details of 00028 * the underlying Entry object (e.g. BinaryEntry). 00029 * To maintain full backwards compatibility, the default behavior remains to 00030 * update the Value property of the Map.Entry. 00031 * <p/> 00032 * <b>Note:</b> subclasses are responsible for POF and/or Lite serialization of 00033 * the updater. 00034 * 00035 * @author gg 2009.09.11 00036 * @since Coherence 3.6 00037 */ 00038 class COH_EXPORT AbstractUpdater 00039 : public abstract_spec<AbstractUpdater, 00040 extends<Object>, 00041 implements<ValueUpdater> > 00042 { 00043 // ----- ValueUpdater interface ----------------------------------------- 00044 00045 public: 00046 /** 00047 * {@inheritDoc} 00048 */ 00049 virtual void update(Object::Handle hTarget, Object::Holder ohValue) const; 00050 00051 00052 // ----- subclassing support -------------------------------------------- 00053 00054 public: 00055 /** 00056 * Update the state of the passed entry using the passed value. 00057 * <p/> 00058 * By overriding this method, an updater implementation is able to update 00059 * the entry's value using all available information on the corresponding 00060 * Map::Entry object and is intended to be used in advanced custom scenarios, 00061 * when application code needs to look at both key and value at the same time 00062 * or can make some very specific assumptions regarding to the implementation 00063 * details of the underlying Entry object. 00064 * 00065 * @param hEntry the Entry object whose value is to be updated 00066 * @param ohValue the new value to update the entry with; for intrinsic 00067 * types, the specified value is expected to be a standard 00068 * wrapper type in the same manner that reflection works 00069 * (e.g. an int value would be passed as a Integer32) 00070 */ 00071 virtual void updateEntry(Map::Entry::Handle hEntry, Object::Holder ohValue) const; 00072 }; 00073 00074 COH_CLOSE_NAMESPACE3 00075 00076 #endif // COH_ABSTRACT_UPDATER_HPP