org.springframework.binding.support
Class PropertyChangeSupportUtils

java.lang.Object
  extended by org.springframework.binding.support.PropertyChangeSupportUtils

public abstract class PropertyChangeSupportUtils
extends Object

Consists exclusively of static convenience methods for adding and removing PropertyChangeListeners for bound JavaBean properties.

TODO: Move this code into BeanUtils

Author:
Karsten Lentzsch, Oliver Hutchison

Constructor Summary
PropertyChangeSupportUtils()
           
 
Method Summary
static void addPropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener)
          Adds a named property change listener to the given JavaBean.
static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener)
          Removes a named property change listener to the given JavaBean.
static boolean supportsBoundProperties(Class beanClass)
          Checks and answers whether the given class supports bound properties, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyChangeSupportUtils

public PropertyChangeSupportUtils()
Method Detail

supportsBoundProperties

public static boolean supportsBoundProperties(Class beanClass)
Checks and answers whether the given class supports bound properties, i.e. it provides a pair of bound property event listener registration methods:
 public void addPropertyChangeListener(String, PropertyChangeListener);
 public void removePropertyChangeListener(String, PropertyChangeListener);
 

Parameters:
beanClass - the class to test
Returns:
true if the class supports bound properties, false otherwise

addPropertyChangeListener

public static void addPropertyChangeListener(Object bean,
                                             String propertyName,
                                             PropertyChangeListener listener)
Adds a named property change listener to the given JavaBean. The bean must provide the optional support for listening on named properties as described in section 7.4.5 of the Java Bean Specification. The bean class must provide the method:
 public void addPropertyChangeListener(String, PropertyChangeListener);
 

Parameters:
bean - the JavaBean to add a property change handler
propertyName - the name of the property to be observed
listener - the listener to add
Throws:
PropertyNotBindableException - if the property change handler cannot be added successfully

removePropertyChangeListener

public static void removePropertyChangeListener(Object bean,
                                                String propertyName,
                                                PropertyChangeListener listener)
Removes a named property change listener to the given JavaBean. The bean must provide the optional support for listening on named properties as described in section 7.4.5 of the Java Bean Specification. The bean class must provide the method:
 public void removePropertyChangeHandler(String, PropertyChangeListener);
 

Parameters:
bean - the bean to remove the property change listener from
propertyName - the name of the observed property
listener - the listener to remove
Throws:
FatalBeanException - if the property change handler cannot be removed successfully


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.