Static Public Member Functions | |
static final String | generateUniqueBeanName (Object bean) |
static final void | registerEditorSearchPaths (String[] pathsToRegister) |
static final void | registerBeanInfoSearchPaths (String[] pathsToRegister) |
static final java.awt.Image | loadImage (final String imagePathname, final Class relatedClass) |
static final Class | findTargetClass (Object bean) |
static final boolean | hasExplicitBeanInfo (Class clazz) |
static void | addWeakListenerByReflection (PropertyChangeListener listener, Object source) |
A few utility methods for Beans.
static void cern.gp.beans.BeanUtils.addWeakListenerByReflection | ( | PropertyChangeListener | listener, | |
Object | source | |||
) | [static] |
Add a weak PropertyChangeListener to an object, using reflection to look up the addPropertyChangeListener method
listener | the listener to add | |
source | the object to which a PCL shall be added |
static final Class cern.gp.beans.BeanUtils.findTargetClass | ( | Object | bean | ) | [static] |
Finds the first public superclass of the given bean. Should not introspect on a private class, because then the method objects used for the property descriptors will not be callable without an IllegalAccessException, even if overriding a public method from a public superclass.
bean | the bean to find the public class from |
References cern.gp.beans.BeanUtils.hasExplicitBeanInfo().
static final String cern.gp.beans.BeanUtils.generateUniqueBeanName | ( | Object | bean | ) | [static] |
Generates a unique name for the bean using the same convention as the implementation of toString() in Object, which is : "bean class name"+@+"hash code of the bean in hexadecimal"
bean | the bean the name has to be generated from |
static final boolean cern.gp.beans.BeanUtils.hasExplicitBeanInfo | ( | Class | clazz | ) | [static] |
Checks whether there is an explicit bean info for given class.
clazz | the class to test |
Referenced by cern.gp.beans.BeanUtils.findTargetClass().
static final java.awt.Image cern.gp.beans.BeanUtils.loadImage | ( | final String | imagePathname, | |
final Class | relatedClass | |||
) | [static] |
This is a utility method to help in loading icon images. It takes the pathname of a resource file associated with the a given class and loads an image object from that file. Typically images will be GIFs.
The pathname should be relative to the given class and be contained in the classpath. For instance if the related class is in cern.gp.beans
and the icon is stored in cern/gp/beans/images/MyIcon.gif
the pathname to give would be images/MyIcon.gif
.
imagePathname | A pathname relative to the directory holding the class file of the given relatedClass. For example, images/MyIcon.gif . | |
relatedClass | the class the image is related with. |
static final void cern.gp.beans.BeanUtils.registerBeanInfoSearchPaths | ( | String[] | pathsToRegister | ) | [static] |
Registers a set of paths in the BeanInfo
search path of the java.beans.Introspector
.
Use this method when you have BeanInfo
named following the convention BeanNameBeanInfo that are not located in the same package as BeanName. For a given java bean a.b.X, the java.beans. Introspector
will first check if there is a BeanInfo a.b.XBeanInfo and if not found it will look in the search path for the class XBeanInfo. You can use this method to register the path where XBeanInfo is. For instance, if the BeanInfo is located in a.c.d.XBeanInfo
you would pass in parameter to this method new String [] {"a.c.d"}
.
Note that paths are not added if they are already present.
pathsToRegister | the array of paths to register in the search path of the Introspector. |
static final void cern.gp.beans.BeanUtils.registerEditorSearchPaths | ( | String[] | pathsToRegister | ) | [static] |
Registers a set of paths in the PropertyEditor
search path of the java.beans.PropertyEditorManager
.
Use this method when you have PropertyEditor
named following the convention TypenameEditor that are not located in the same package as Typename. For a given java type a.b.X, the java.beans.PropertyEditorManager
will first check if there is an editor registered for the type, if not it will look for the editor a.b.XEditor and if not found it will look in the search path for the class XEditor. You can use this method to register the path where XEditor is. For instance, if the editor is located in a.c.d.XEditor
you would pass in parameter to this method new String[] {"a.c.d"}
.
Note that paths are not added if they are already present.
pathsToRegister | the array of paths to register in the search path of the PropertyEditorManager. |