001 /*
002 * Copyright 2002-2004 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 import java.beans.PropertyChangeListener;
019
020 /**
021 * Interface implemented by domain objects that can publish property change
022 * events. Clients can use this interface to subscribe to the object for change
023 * notifications.
024 *
025 * @author Keith Donald
026 */
027 public interface PropertyChangePublisher {
028
029 /**
030 * Register a listener to all properties of this publisher.
031 *
032 * @param listener the <code>PropertyChangeListener</code> to register.
033 */
034 void addPropertyChangeListener(PropertyChangeListener listener);
035
036 /**
037 * Register a listener to a specific property.
038 *
039 * @param propertyName the property to monitor.
040 * @param listener the <code>PropertyChangeListener</code> to register.
041 */
042 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
043
044 /**
045 * Remove the listener from all properties of this publisher.
046 *
047 * @param listener the <code>PropertyChangeListener</code> to remove.
048 */
049 void removePropertyChangeListener(PropertyChangeListener listener);
050
051 /**
052 * Remove the listener from a specific property.
053 *
054 * @param propertyName the property that was being monitored.
055 * @param listener the <code>PropertyChangeListener</code> to remove.
056 */
057 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
058 }