public final class BeanUtils extends Object
Introspector
,
BeanInfo
,
PropertyDescriptor
Modifier and Type | Method and Description |
---|---|
static void |
addPropertyChangeListener(Object bean,
Class<?> beanClass,
PropertyChangeListener listener)
Adds a property change listener to the given bean.
|
static void |
addPropertyChangeListener(Object bean,
Class<?> beanClass,
String propertyName,
PropertyChangeListener listener)
Adds a named property change listener to the given bean.
|
static void |
addPropertyChangeListener(Object bean,
PropertyChangeListener listener)
Adds a property change listener to the given bean.
|
static void |
addPropertyChangeListener(Object bean,
String propertyName,
PropertyChangeListener listener)
Adds a named property change listener to the given bean.
|
static Method |
getNamedPCLAdder(Class<?> clazz)
Looks up and returns the method that adds a PropertyChangeListener
for a specified property name to instances of the given class.
|
static Method |
getNamedPCLRemover(Class<?> clazz)
Looks up and returns the method that removes a PropertyChangeListener
for a specified property name from instances of the given class.
|
static Method |
getPCLAdder(Class<?> clazz)
Looks up and returns the method that adds a multicast
PropertyChangeListener to instances of the given class.
|
static Method |
getPCLRemover(Class<?> clazz)
Looks up and returns the method that removes a multicast
PropertyChangeListener from instances of the given class.
|
static void |
removePropertyChangeListener(Object bean,
Class<?> beanClass,
PropertyChangeListener listener)
Removes a property change listener from the given bean.
|
static void |
removePropertyChangeListener(Object bean,
Class<?> beanClass,
String propertyName,
PropertyChangeListener listener)
Removes a named property change listener from the given bean.
|
static void |
removePropertyChangeListener(Object bean,
PropertyChangeListener listener)
Removes a property change listener from the given bean.
|
static void |
removePropertyChangeListener(Object bean,
String propertyName,
PropertyChangeListener listener)
Removes a named property change listener from the given bean.
|
static boolean |
supportsBoundProperties(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
PropertyChangeListener s:
public void addPropertyChangeListener(PropertyChangeListener x);
public void removePropertyChangeListener(PropertyChangeListener x);
|
public static boolean supportsBoundProperties(Class<?> clazz)
PropertyChangeListener
s:
public void addPropertyChangeListener(PropertyChangeListener x); public void removePropertyChangeListener(PropertyChangeListener x);
clazz
- the class to testpublic static Method getPCLAdder(Class<?> clazz)
clazz
- the class that provides the adder methodpublic static Method getPCLRemover(Class<?> clazz)
clazz
- the class that provides the remover methodpublic static Method getNamedPCLAdder(Class<?> clazz)
clazz
- the class that provides the adder methodpublic static Method getNamedPCLRemover(Class<?> clazz)
clazz
- the class that provides the remover methodpublic static void addPropertyChangeListener(Object bean, Class<?> beanClass, PropertyChangeListener listener)
beanClass
can be a type other than bean.getClass()
,
for example if the bean is specified by public interfaces,
and implemented by package private class.
bean
- the bean to add the property change listener tobeanClass
- the Bean class used to lookup methods fromlistener
- the listener to addNullPointerException
- if the bean or listener is null
IllegalArgumentException
- if the bean is not an instance of the bean classPropertyUnboundException
- if the bean does not support bound propertiesPropertyNotBindableException
- if the property change handler cannot be added successfullypublic static void addPropertyChangeListener(Object bean, Class<?> beanClass, String propertyName, PropertyChangeListener listener)
public void addPropertyChangeListener(String name, PropertyChangeListener l);
beanClass
can be a type other than bean.getClass()
,
for example if the bean is specified by public interfaces,
and implemented by package private class.
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 addNullPointerException
- if the bean, propertyName or listener is null
IllegalArgumentException
- if the bean is not an instance of the bean classPropertyNotBindableException
- if the property change handler cannot be added successfullypublic static void addPropertyChangeListener(Object bean, PropertyChangeListener listener)
bean
- the bean to add the property change listener tolistener
- the listener to addNullPointerException
- if the bean or listener is null
PropertyUnboundException
- if the bean does not support bound propertiesPropertyNotBindableException
- if the property change handler cannot be added successfullypublic static void addPropertyChangeListener(Object bean, String propertyName, 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 addNullPointerException
- if the bean, propertyName or listener is null
PropertyNotBindableException
- if the property change handler cannot be added successfullypublic static void removePropertyChangeListener(Object bean, Class<?> beanClass, PropertyChangeListener listener)
beanClass
can be a type other than bean.getClass()
,
for example if the bean is specified by public interfaces,
and implemented by package private class.
bean
- the bean to remove the property change listener frombeanClass
- the Java Bean class used to lookup methods fromlistener
- the listener to removeNullPointerException
- if the bean or listener is null
IllegalArgumentException
- if the bean is not an instance of the bean classPropertyUnboundException
- if the bean does not support bound propertiesPropertyNotBindableException
- if the property change handler cannot be removed successfullypublic static void removePropertyChangeListener(Object bean, Class<?> beanClass, String propertyName, PropertyChangeListener listener)
public void removePropertyChangeHandler(String name, PropertyChangeListener l);
beanClass
can be a type other than bean.getClass()
,
for example if the bean is specified by public interfaces,
and implemented by package private class.
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 removeNullPointerException
- if the bean, propertyName, or listener is null
IllegalArgumentException
- if the bean is not an instance of the bean classPropertyNotBindableException
- if the property change handler cannot be removed successfullypublic static void removePropertyChangeListener(Object bean, PropertyChangeListener listener)
bean
- the bean to remove the property change listener fromlistener
- the listener to removeNullPointerException
- if the bean or listener is null
PropertyUnboundException
- if the bean does not support bound propertiesPropertyNotBindableException
- if the property change handler cannot be removed successfullypublic static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener)
public void removePropertyChangeHandler(String name, PropertyChangeListener l);
beanClass
can be a type other than bean.getClass()
,
for example if the bean is specified by public interfaces,
and implemented by package private class.
bean
- the bean to remove the property change listener frompropertyName
- the name of the observed propertylistener
- the listener to removeNullPointerException
- if the bean, propertyName, or listener is null
PropertyNotBindableException
- if the property change handler cannot be removed successfullyCopyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.