Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » beans » [javadoc | source]
java.beans
public class: Introspector [javadoc | source]
java.lang.Object
   java.beans.Introspector
The Introspector is a utility for developers to figure out which properties, events, and methods a JavaBean supports.

The Introspector class walks over the class/superclass chain of the target bean class. At each level it checks if there is a matching BeanInfo class which provides explicit information about the bean, and if so uses that explicit information. Otherwise it uses the low level reflection APIs to study the target class and uses design patterns to analyze its behaviour and then proceeds to continue the introspection with its baseclass.

To look for the explicit information of a bean:

  1. The Introspector appends "BeanInfo" to the qualified name of the bean class, try to use the new class as the "BeanInfo" class. If the "BeanInfo" class exsits and returns non-null value when queried for explicit information, use the explicit information
  2. If the first step fails, the Introspector will extract a simple class name of the bean class by removing the package name from the qualified name of the bean class, append "BeanInfo" to it. And look for the simple class name in the packages defined in the "BeanInfo" search path (The default "BeanInfo" search path is sun.beans.infos). If it finds a "BeanInfo" class and the "BeanInfo" class returns non-null value when queried for explicit information, use the explicit information
Field Summary
public static final  int IGNORE_ALL_BEANINFO    Constant values to indicate that the Introspector will ignore all BeanInfo class. 
public static final  int IGNORE_IMMEDIATE_BEANINFO    Constant values to indicate that the Introspector will ignore the BeanInfo class of the current bean class. 
public static final  int USE_ALL_BEANINFO    Constant values to indicate that the Introspector will use all BeanInfo class which have been found. This is the default one. 
Method from java.beans.Introspector Summary:
decapitalize,   flushCaches,   flushFromCaches,   getBeanInfo,   getBeanInfo,   getBeanInfo,   getBeanInfoSearchPath,   setBeanInfoSearchPath
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.beans.Introspector Detail:
 public static String decapitalize(String name) 
    Decapitalizes a given string according to the rule:
    • If the first or only character is Upper Case, it is made Lower Case
    • UNLESS the second character is also Upper Case, when the String is returned unchanged
 public static  void flushCaches() 
    Flushes all BeanInfo caches.
 public static  void flushFromCaches(Class<?> clazz) 
    Flushes the BeanInfo caches of the specified bean class
 public static BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException 
    Gets the BeanInfo object which contains the information of the properties, events and methods of the specified bean class.

    The Introspector will cache the BeanInfo object. Subsequent calls to this method will be answered with the cached data.

 public static BeanInfo getBeanInfo(Class<?> beanClass,
    Class<?> stopClass) throws IntrospectionException 
    Gets the BeanInfo object which contains the information of the properties, events and methods of the specified bean class. It will not introspect the "stopclass" and its super class.

    The Introspector will cache the BeanInfo object. Subsequent calls to this method will be answered with the cached data.

 public static BeanInfo getBeanInfo(Class<?> beanClass,
    int flags) throws IntrospectionException 
    Gets the BeanInfo object which contains the information of the properties, events and methods of the specified bean class.
    1. If flag==IGNORE_ALL_BEANINFO, the Introspector will ignore all BeanInfo class.
    2. If flag==IGNORE_IMMEDIATE_BEANINFO, the Introspector will ignore the BeanInfo class of the current bean class.
    3. If flag==USE_ALL_BEANINFO, the Introspector will use all BeanInfo class which have been found.

    The Introspector will cache the BeanInfo object. Subsequent calls to this method will be answered with the cached data.

 public static String[] getBeanInfoSearchPath() 
    Gets an array of search packages.
 public static  void setBeanInfoSearchPath(String[] path) 
    Sets the search packages.