|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgoodies.binding.beans.BeanUtils
public final class BeanUtils
Consists exclusively of static methods that provide convenience behavior for working with Java Bean properties.
Introspector,
BeanInfo,
PropertyDescriptor| Method Summary | |
|---|---|
static void |
addPropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.beans.PropertyChangeListener listener)
Adds a property change listener to the given bean. |
static void |
addPropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a named property change listener to the given bean. |
static void |
addPropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
Adds a property change listener to the given bean. |
static void |
addPropertyChangeListener(java.lang.Object bean,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a named property change listener to the given bean. |
static java.lang.reflect.Method |
getNamedPCLAdder(java.lang.Class<?> clazz)
Looks up and returns the method that adds a PropertyChangeListener for a specified property name to instances of the given class. |
static java.lang.reflect.Method |
getNamedPCLRemover(java.lang.Class<?> clazz)
Looks up and returns the method that removes a PropertyChangeListener for a specified property name from instances of the given class. |
static java.lang.reflect.Method |
getPCLAdder(java.lang.Class<?> clazz)
Looks up and returns the method that adds a multicast PropertyChangeListener to instances of the given class. |
static java.lang.reflect.Method |
getPCLRemover(java.lang.Class<?> clazz)
Looks up and returns the method that removes a multicast PropertyChangeListener from instances of the given class. |
static java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.Class<?> beanClass,
java.lang.String propertyName)
Looks up and returns a PropertyDescriptor for the
given Java Bean class and property name using the standard
Java Bean introspection behavior. |
static java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.lang.String getterName,
java.lang.String setterName)
Looks up and returns a PropertyDescriptor for the given
Java Bean class and property name. |
static java.lang.Object |
getValue(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor)
Returns the value of the specified property of the given non-null bean. |
static void |
removePropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.beans.PropertyChangeListener listener)
Removes a property change listener from the given bean. |
static void |
removePropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a named property change listener from the given bean. |
static void |
removePropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
Removes a property change listener from the given bean. |
static void |
removePropertyChangeListener(java.lang.Object bean,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a named property change listener from the given bean. |
static void |
setValue(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor,
java.lang.Object newValue)
Sets the given object as new value of the specified property of the given non-null bean. |
static boolean |
supportsBoundProperties(java.lang.Class<?> clazz)
Checks and answers whether the given class supports bound properties, i.e. it provides a pair of multicast event listener registration methods for PropertyChangeListeners:
public void addPropertyChangeListener(PropertyChangeListener x);
public void removePropertyChangeListener(PropertyChangeListener x);
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean supportsBoundProperties(java.lang.Class<?> clazz)
PropertyChangeListeners:
public void addPropertyChangeListener(PropertyChangeListener x); public void removePropertyChangeListener(PropertyChangeListener x);
clazz - the class to test
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class<?> beanClass,
java.lang.String propertyName)
throws java.beans.IntrospectionException
PropertyDescriptor for the
given Java Bean class and property name using the standard
Java Bean introspection behavior.
beanClass - the type of the bean that holds the propertypropertyName - the name of the Bean property
PropertyDescriptor associated with the given
bean and property name as returned by the Bean introspection
java.beans.IntrospectionException - if an exception occurs during
introspection.
java.lang.NullPointerException - if the beanClass or propertyName is null
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.lang.String getterName,
java.lang.String setterName)
PropertyDescriptor for the given
Java Bean class and property name. If a getter name or setter name
is available, these are used to create a PropertyDescriptor.
Otherwise, the standard Java Bean introspection is used to determine
the property descriptor.
beanClass - the class of the bean that holds the propertypropertyName - the name of the property to be accessedgetterName - the optional name of the property's gettersetterName - the optional name of the property's setter
PropertyDescriptor associated with the
given bean and property name
PropertyNotFoundException - if the property could not be foundpublic static java.lang.reflect.Method getPCLAdder(java.lang.Class<?> clazz)
clazz - the class that provides the adder method
public static java.lang.reflect.Method getPCLRemover(java.lang.Class<?> clazz)
clazz - the class that provides the remover method
public static java.lang.reflect.Method getNamedPCLAdder(java.lang.Class<?> clazz)
clazz - the class that provides the adder method
public static java.lang.reflect.Method getNamedPCLRemover(java.lang.Class<?> clazz)
clazz - the class that provides the remover method
public static void addPropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.beans.PropertyChangeListener listener)
bean - the bean to add the property change listener tobeanClass - the Bean class used to lookup methods fromlistener - the listener to add
java.lang.NullPointerException - if the bean or listener is null
java.lang.IllegalArgumentException - if the bean is not an instance of the bean class
PropertyUnboundException - if the bean does not support bound properties
PropertyNotBindableException - if the property change handler cannot be added successfully
public static void addPropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(String name, PropertyChangeListener l);
bean - the bean to add a property change handlerbeanClass - the Bean class used to lookup methods frompropertyName - the name of the property to be observedlistener - the listener to add
java.lang.NullPointerException - if the bean, propertyName or listener is null
java.lang.IllegalArgumentException - if the bean is not an instance of the bean class
PropertyNotBindableException - if the property change handler cannot be added successfully
public static void addPropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
bean - the bean to add the property change listener tolistener - the listener to add
java.lang.NullPointerException - if the bean or listener is null
PropertyUnboundException - if the bean does not support bound properties
PropertyNotBindableException - if the property change handler cannot be added successfully
public static void addPropertyChangeListener(java.lang.Object bean,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(String name, PropertyChangeListener l);
bean - the bean to add a property change handlerpropertyName - the name of the property to be observedlistener - the listener to add
java.lang.NullPointerException - if the bean, propertyName or listener is null
PropertyNotBindableException - if the property change handler cannot be added successfully
public static void removePropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.beans.PropertyChangeListener listener)
bean - the bean to remove the property change listener frombeanClass - the Java Bean class used to lookup methods fromlistener - the listener to remove
java.lang.NullPointerException - if the bean or listener is null
java.lang.IllegalArgumentException - if the bean is not an instance of the bean class
PropertyUnboundException - if the bean does not support bound properties
PropertyNotBindableException - if the property change handler cannot be removed successfully
public static void removePropertyChangeListener(java.lang.Object bean,
java.lang.Class<?> beanClass,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void removePropertyChangeHandler(String name, PropertyChangeListener l);
bean - the bean to remove the property change listener frombeanClass - the Java Bean class used to lookup methods frompropertyName - the name of the observed propertylistener - the listener to remove
java.lang.NullPointerException - if the bean, propertyName, or listener is null
java.lang.IllegalArgumentException - if the bean is not an instance of the bean class
PropertyNotBindableException - if the property change handler cannot be removed successfully
public static void removePropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
bean - the bean to remove the property change listener fromlistener - the listener to remove
java.lang.NullPointerException - if the bean or listener is null
PropertyUnboundException - if the bean does not support bound properties
PropertyNotBindableException - if the property change handler cannot be removed successfully
public static void removePropertyChangeListener(java.lang.Object bean,
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void removePropertyChangeHandler(String name, PropertyChangeListener l);
bean - the bean to remove the property change listener frompropertyName - the name of the observed propertylistener - the listener to remove
java.lang.NullPointerException - if the bean, propertyName, or listener is null
PropertyNotBindableException - if the property change handler cannot be removed successfully
public static java.lang.Object getValue(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor)
If the read access fails, a PropertyAccessException is thrown that provides the Throwable that caused the failure.
bean - the bean to read the value frompropertyDescriptor - describes the property to be read
java.lang.NullPointerException - if the bean is null
java.lang.UnsupportedOperationException - if the bean property is write-only
PropertyAccessException - if the new value could not be read
public static void setValue(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor,
java.lang.Object newValue)
throws java.beans.PropertyVetoException
If the write access fails, a PropertyAccessException is thrown that provides the Throwable that caused the failure. If the bean property is constrained and a VetoableChangeListener has vetoed against the value change, the PropertyAccessException wraps the PropertyVetoException thrown by the setter.
bean - the bean that holds the adapted propertypropertyDescriptor - describes the property to be setnewValue - the property value to be set
java.lang.NullPointerException - if the bean is null
java.lang.UnsupportedOperationException - if the bean property is read-only
PropertyAccessException - if the new value could not be set
java.beans.PropertyVetoException - if the bean setter throws this exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||