coherence/util/filter/ValueChangeEventFilter.hpp

00001 /*
00002 * ValueChangeEventFilter.hpp
00003 *
00004 * Copyright (c) 2000, 2009, 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_VALUE_CHANGE_EVENT_FILTER_HPP
00017 #define COH_VALUE_CHANGE_EVENT_FILTER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/filter/ExtractorFilter.hpp"
00022 #include "coherence/util/ValueExtractor.hpp"
00023 
00024 COH_OPEN_NAMESPACE3(coherence,util,filter)
00025 
00026 
00027 /**
00028 * Filter which evaluates the content of a MapEvent values based on the
00029 * specified value extractor.  This filter evaluates to true only for update
00030 * events that change the value of an extracted attribute.
00031 *
00032 * Example: a filter that evaluates to true if there is an update to an
00033 * Employee object that changes a value of the LastName property.
00034 * <pre>
00035 *   ValueChangeEventFilter::create(ReflectionExtractor::create("LastName"));
00036 * </pre>
00037 *
00038 * see MapEventFilter
00039 *
00040 * @author djl  2008.05.19
00041 */
00042 class COH_EXPORT ValueChangeEventFilter
00043     : public class_spec<ValueChangeEventFilter,
00044         extends<ExtractorFilter> >
00045     {
00046     friend class factory<ValueChangeEventFilter>;
00047 
00048     // ----- constructors ---------------------------------------------------
00049 
00050     protected:
00051         /**
00052         * Default constructor (necessary for the PortableObject interface).
00053         */
00054         ValueChangeEventFilter();
00055 
00056         /**
00057         * Construct a ValueChangeEventFilter that evaluates MapEvent values
00058         * based on the specified extractor.
00059         *
00060         * @param vExtractor  ValueExtractor to extract MapEvent values
00061         */
00062         ValueChangeEventFilter(ValueExtractor::View vValueExtractor);
00063 
00064 
00065     // ----- ExtractorFilter interface --------------------------------------
00066 
00067     protected:
00068         /**
00069         * Evaluate the specified extracted value.
00070         *
00071         * @param vExtracted  an extracted value to evaluate
00072         */
00073         virtual bool evaluateExtracted(Object::View vExtracted) const;
00074 
00075 
00076     // ----- Filter interface -----------------------------------------------
00077 
00078     public:
00079         /**
00080         * {@inheritDoc}
00081         */
00082         virtual bool evaluate(Object::View v) const;
00083 
00084 
00085     // ----- Object interface -----------------------------------------------
00086 
00087     public:
00088         /**
00089         * {@inheritDoc}
00090         */
00091         virtual bool equals(Object::View v) const;
00092 
00093         /**
00094         * {@inheritDoc}
00095         */
00096         virtual size32_t hashCode() const;
00097 
00098         /**
00099         * {@inheritDoc}
00100         */
00101         virtual void toStream(std::ostream& out) const;
00102     };
00103 
00104 COH_CLOSE_NAMESPACE3
00105 
00106 #endif // COH_VALUE_CHANGE_EVENT_FILTER_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.