001    /**
002     * Copyright 2002-2005 the original author or authors.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005     * use this file except in compliance with the License. You may obtain a copy of
006     * the License at
007     * 
008     * http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013     * License for the specific language governing permissions and limitations under
014     * the License.
015     */
016    package org.springframework.binding.value;
017    
018    /**
019     * Defines the operations for determining if two values (an old and a new value) are
020     * different enough to indicate a change in the value model. An implementation of this
021     * interface can be registered in the application context configuration. The configured
022     * instance is used in several classes to determine if two object values are sufficiently
023     * different to trigger further logic, like firing a value changed event, updating
024     * conversion values, etc.
025     * 
026     * @author Larry Streepy
027     * @see org.springframework.richclient.application.ApplicationServices
028     * @see org.springframework.binding.value.support.DefaultValueChangeDetector
029     * @see org.springframework.binding.value.support.EquivalenceValueChangeDetector
030     */
031    public interface ValueChangeDetector {
032    
033        /**
034         * Determine if there has been a change between two values (an old and a new value).
035         * The definition of <em>different enough</em>, is dependent upon the needs of a
036         * ValueModel implementation.
037         * 
038         * @param oldValue Original object value
039         * @param newValue New object value
040         * @return true if the objects are different enough to indicate a change in the value
041         *         model
042         */
043        public boolean hasValueChanged(Object oldValue, Object newValue);
044    }