All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.beans.Introspector

java.lang.Object
   |
   +----java.beans.Introspector

public class Introspector
extends Object
The Introspector class provides a standard way for tools to learn about the properties, events, and methods supported by a target Java Bean.

For each of those three kinds of information, the Introspector will separately analyze the bean's class and superclasses looking for either explicit or implicit information and use that information to build a BeanInfo object that comprehensively describes the target bean.

For each class "Foo", explicit information may be available if there exists a corresponding "FooBeanInfo" class that provides a non-null value when queried for the information. We first look for the BeanInfo class by taking the full package-qualified name of the target bean class and appending "BeanInfo" to form a new class name. If this fails, then we take the final classname component of this name, and look for that class in each of the packages specified in the BeanInfo package search path.

Thus for a class such as "sun.xyz.OurButton" we would first look for a BeanInfo class called "sun.xyz.OurButtonBeanInfo" and if that failed we'd look in each package in the BeanInfo search path for an OurButtonBeanInfo class. With the default search path, this would mean looking for "sun.beans.infos.OurButtonBeanInfo".

If a class provides explicit BeanInfo about itself then we add that to the BeanInfo information we obtained from analyzing any derived classes, but we regard the explicit information as being definitive for the current class and its base classes, and do not proceed any further up the superclass chain.

If we don't find explicit BeanInfo on a class, we use low-level reflection to study the methods of the class and apply standard design patterns to identify property accessors, event sources, or public methods. We then proceed to analyze the class's superclass and add in the information from it (and possibly on up the superclass chain).


Method Index

 o decapitalize(String)
Utility method to take a string and convert it to normal Java variable name capitalization.
 o getBeanInfo(Class)
Introspect on a Java bean and learn about all its properties, exposed methods, and events.
 o getBeanInfo(Class, Class)
Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point.
 o getBeanInfoSearchPath()
 o setBeanInfoSearchPath(String[])
Change the list of package names that will be used for finding BeanInfo classes.

Methods

 o getBeanInfo
 public static BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException
Introspect on a Java bean and learn about all its properties, exposed methods, and events.

Parameters:
beanClass - The bean class to be analyzed.
Returns:
A BeanInfo object describing the target bean.
Throws: IntrospectionException
if an exception occurs during introspection.
 o getBeanInfo
 public static BeanInfo getBeanInfo(Class beanClass,
                                    Class stopClass) throws IntrospectionException
Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point.

Parameters:
bean - The bean class to be analyzed.
stopClass - The baseclass at which to stop the analysis. Any methods/properties/events in the stopClass or in its baseclasses will be ignored in the analysis.
Throws: IntrospectionException
if an exception occurs during introspection.
 o decapitalize
 public static String decapitalize(String name)
Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case, but in the (unusual) special case when there is more than one character and both the first and second characters are upper case, we leave it alone.

Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".

Parameters:
name - The string to be decapitalized.
Returns:
The decapitalized version of the string.
 o getBeanInfoSearchPath
 public static String[] getBeanInfoSearchPath()
Returns:
The array of package names that will be searched in order to find BeanInfo classes.

This is initially set to {"sun.beans.infos"}.

 o setBeanInfoSearchPath
 public static void setBeanInfoSearchPath(String path[])
Change the list of package names that will be used for finding BeanInfo classes.

Parameters:
path - Array of package names.

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature