Additional top-level class in compilation unit: GenericBeanInfo.
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).
For more information about introspection and design patterns, please consult the JavaBeans specification.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final String | |
| private BeanInfo[] | |
| private Class | |
| private int | |
| private String | |
| private int | |
| private String | |
| private static final EventSetDescriptor[] | |
| private Map | |
| private BeanInfo | |
| pack-priv static final String | |
| public static final int | IGNORE_ALL_BEANINFO
Flag to indicate to ignore all beaninfo. |
| public static final int | IGNORE_IMMEDIATE_BEANINFO
Flag to indicate to ignore immediate beaninfo. |
| pack-priv static final String | |
| private Map | |
| private HashMap | |
| private Map | |
| private boolean | |
| pack-priv static final String | |
| pack-priv static final String | |
| private BeanInfo | |
| public static final int | USE_ALL_BEANINFO
Flag to indicate to use of all beaninfo. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| private void | |
| public static String | Returns: The decapitalized version of the string.The string to be decapitalized. name)Utility method to take a string and convert it to normal Java variable name capitalization. |
| private static Class | |
| private static BeanInfo | Returns: Instance of an explicit BeanInfo class or null if one isn't found.the class type of the bean beanClass)Looks for an explicit BeanInfo class that corresponds to the Class. |
| pack-priv static Method | |
| pack-priv static Method | Returns: the method or null if not foundThe Class object on which to retrieve the method. cls, String Name of the method. methodName, int Number of arguments for the desired method. argCount, Class<?>[] Array of argument types for the method. args)Find a target methodName with specific parameter list on a given class. |
| public static void | |
| public static void | flushFromCaches(Class<?>
Class object to be flushed. clz)Flush the Introspector's internal cached information for a given class. |
| public static BeanInfo | Returns: A BeanInfo object describing the target bean.The bean class to be analyzed. beanClass)Introspect on a Java Bean and learn about all its properties, exposed methods, and events. |
| public static BeanInfo | Returns: A BeanInfo object describing the target bean.The bean class to be analyzed. beanClass, int Flags to control the introspection.
If flags == USE_ALL_BEANINFO then we use all of the BeanInfo
classes we can discover.
If flags == IGNORE_IMMEDIATE_BEANINFO then we ignore any
BeanInfo associated with the specified beanClass.
If flags == IGNORE_ALL_BEANINFO then we ignore all BeanInfo
associated with the specified beanClass or any of its
parent classes. flags)Introspect on a Java bean and learn about all its properties, exposed methods, and events, subject to some control flags. |
| public static BeanInfo | Returns: the BeanInfo for the beanThe bean class to be analyzed. beanClass, Class<?> 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. stopClass)Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point. |
| public static BeanInfo | Returns: a BeanInfo object describing the target beanthe bean class to be analyzed beanClass, Class<?> the parent class at which to stop the analysis stopClass, int flags to control the introspection flags)Introspect on a Java Bean and learn about all its properties,
exposed methods and events, below a given |
| private BeanInfo | |
| public static String[] | Returns: The array of package names that will be searched in order to find BeanInfo classes. The default value for this array is implementation-dependent; e.g. Sun implementation initially sets to {"sun.beans.infos"}.Gets the list of package names that will be used for finding BeanInfo classes. |
| private PropertyDescriptor[] | |
| private BeanDescriptor | |
| private int | |
| private int | |
| private EventSetDescriptor[] | getTargetEventInfo()
Returns: An array of EventSetDescriptors describing the kinds of events fired by the target bean. |
| private MethodDescriptor[] | getTargetMethodInfo()
Returns: An array of MethodDescriptors describing the private methods supported by the target bean. |
| private PropertyDescriptor[] | getTargetPropertyInfo()
Returns: An array of PropertyDescriptors describing the editable properties supported by the target bean. |
| pack-priv static Object | |
| private static Method | internalFindMethod(Class<?> start, String methodName, int argCount, Class<?>[] args)
Internal support for finding a target methodName with a given parameter list on a given class. |
| private static boolean | |
| private boolean | |
| pack-priv static boolean | isSubclass(Class<?> a, Class<?> b)
Return true if class a is either equivalent to class b, or if class a is a subclass of class b, i.e. if a either "extends" or "implements" b. |
| private static String | |
| private PropertyDescriptor | mergePropertyDescriptor(IndexedPropertyDescriptor ipd, PropertyDescriptor pd)
Adds the property descriptor to the indexedproperty descriptor only if the types are the same. |
| private PropertyDescriptor | |
| private IndexedPropertyDescriptor | |
| private PropertyDescriptor | |
| private void | processPropertyDescriptors()
Populates the property descriptor table by merging the lists of Property descriptors. |
| public static void | setBeanInfoSearchPath(String[]
Array of package names. path)Change the list of package names that will be used for finding BeanInfo classes. |
| ADD_PREFIX | back to summary |
|---|---|
| pack-priv static final String ADD_PREFIX | |
| additionalBeanInfo | back to summary |
|---|---|
| private BeanInfo[] additionalBeanInfo | |
| beanClass | back to summary |
|---|---|
| private Class<?> beanClass | |
| defaultEventIndex | back to summary |
|---|---|
| private int defaultEventIndex | |
| defaultEventName | back to summary |
|---|---|
| private String defaultEventName | |
| defaultPropertyIndex | back to summary |
|---|---|
| private int defaultPropertyIndex | |
| defaultPropertyName | back to summary |
|---|---|
| private String defaultPropertyName | |
| EMPTY_EVENTSETDESCRIPTORS | back to summary |
|---|---|
| private static final EventSetDescriptor[] EMPTY_EVENTSETDESCRIPTORS | |
| events | back to summary |
|---|---|
| private Map<String, EventSetDescriptor> events | |
| explicitBeanInfo | back to summary |
|---|---|
| private BeanInfo explicitBeanInfo | |
| GET_PREFIX | back to summary |
|---|---|
| pack-priv static final String GET_PREFIX | |
| IGNORE_ALL_BEANINFO | back to summary |
|---|---|
| public static final int IGNORE_ALL_BEANINFO Flag to indicate to ignore all beaninfo.
| |
| IGNORE_IMMEDIATE_BEANINFO | back to summary |
|---|---|
| public static final int IGNORE_IMMEDIATE_BEANINFO Flag to indicate to ignore immediate beaninfo.
| |
| IS_PREFIX | back to summary |
|---|---|
| pack-priv static final String IS_PREFIX | |
| methods | back to summary |
|---|---|
| private Map<String, MethodDescriptor> methods | |
| pdStore | back to summary |
|---|---|
| private HashMap<String, List<PropertyDescriptor>> pdStore | |
| properties | back to summary |
|---|---|
| private Map<String, PropertyDescriptor> properties | |
| propertyChangeSource | back to summary |
|---|---|
| private boolean propertyChangeSource | |
| REMOVE_PREFIX | back to summary |
|---|---|
| pack-priv static final String REMOVE_PREFIX | |
| SET_PREFIX | back to summary |
|---|---|
| pack-priv static final String SET_PREFIX | |
| superBeanInfo | back to summary |
|---|---|
| private BeanInfo superBeanInfo | |
| USE_ALL_BEANINFO | back to summary |
|---|---|
| public static final int USE_ALL_BEANINFO Flag to indicate to use of all beaninfo.
| |
| Introspector | back to summary |
|---|---|
| private Introspector(Class<?> beanClass, Class<?> stopClass, int flags) throws IntrospectionException | |
| addEvent | back to summary |
|---|---|
| private void addEvent(EventSetDescriptor esd) | |
| addMethod | back to summary |
|---|---|
| private void addMethod(MethodDescriptor md) | |
| addPropertyDescriptor | back to summary |
|---|---|
| private void addPropertyDescriptor(PropertyDescriptor pd) Adds the property descriptor to the list store. | |
| addPropertyDescriptors | back to summary |
|---|---|
| private void addPropertyDescriptors(PropertyDescriptor[] descriptors) | |
| decapitalize | back to summary |
|---|---|
| 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". | |
| findCustomizerClass | back to summary |
|---|---|
| private static Class | |
| findExplicitBeanInfo | back to summary |
|---|---|
| private static BeanInfo findExplicitBeanInfo(Class<?> beanClass) Looks for an explicit BeanInfo class that corresponds to the Class. First it looks in the existing package that the Class is defined in, then it checks to see if the class is its own BeanInfo. Finally, the BeanInfo search path is prepended to the class and searched. | |
| findMethod | back to summary |
|---|---|
| pack-priv static Method findMethod(Class<?> cls, String methodName, int argCount) Find a target methodName on a given class. | |
| findMethod | back to summary |
|---|---|
| pack-priv static Method findMethod(Class<?> cls, String methodName, int argCount, Class<?>[] args) Find a target methodName with specific parameter list on a given class. Used in the constructors of the EventSetDescriptor, PropertyDescriptor and the IndexedPropertyDescriptor.
| |
| flushCaches | back to summary |
|---|---|
| public static void flushCaches() Flush all of the Introspector's internal caches. This method is not normally required. It is normally only needed by advanced tools that update existing "Class" objects in-place and need to make the Introspector re-analyze existing Class objects.
| |
| flushFromCaches | back to summary |
|---|---|
| public static void flushFromCaches(Class<?> clz) Flush the Introspector's internal cached information for a given class. This method is not normally required. It is normally only needed by advanced tools that update existing "Class" objects in-place and need to make the Introspector re-analyze an existing Class object. Note that only the direct state associated with the target Class object is flushed. We do not flush state for other Class objects with the same name, nor do we flush state for any related Class objects (such as subclasses), even though their state may include information indirectly obtained from the target Class object.
| |
| getBeanInfo | back to summary |
|---|---|
| public static BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException Introspect on a Java Bean and learn about all its properties, exposed methods, and events. If the BeanInfo class for a Java Bean has been previously Introspected then the BeanInfo class is retrieved from the BeanInfo cache.
| |
| getBeanInfo | back to summary |
|---|---|
| public static BeanInfo getBeanInfo(Class<?> beanClass, int flags) throws IntrospectionException Introspect on a Java bean and learn about all its properties, exposed methods, and events, subject to some control flags. If the BeanInfo class for a Java Bean has been previously Introspected based on the same arguments then the BeanInfo class is retrieved from the BeanInfo cache.
| |
| getBeanInfo | back to summary |
|---|---|
| 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. If the BeanInfo class for a Java Bean has been previously Introspected based on the same arguments, then the BeanInfo class is retrieved from the BeanInfo cache.
| |
| getBeanInfo | back to summary |
|---|---|
| public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass, int flags) throws IntrospectionException Introspect on a Java Bean and learn about all its properties,
exposed methods and events, below a given
stopClass
or in its parent classes will be ignored in the analysis.
If the BeanInfo class for a Java Bean has been previously introspected based on the same arguments then the BeanInfo class is retrieved from the BeanInfo cache.
| |
| getBeanInfo | back to summary |
|---|---|
| private BeanInfo getBeanInfo() throws IntrospectionException Constructs a GenericBeanInfo class from the state of the Introspector | |
| getBeanInfoSearchPath | back to summary |
|---|---|
| public static String[] getBeanInfoSearchPath() Gets the list of package names that will be used for finding BeanInfo classes.
| |
| getPropertyDescriptors | back to summary |
|---|---|
| private PropertyDescriptor[] getPropertyDescriptors(BeanInfo info) | |
| getTargetBeanDescriptor | back to summary |
|---|---|
| private BeanDescriptor getTargetBeanDescriptor() | |
| getTargetDefaultEventIndex | back to summary |
|---|---|
| private int getTargetDefaultEventIndex() | |
| getTargetDefaultPropertyIndex | back to summary |
|---|---|
| private int getTargetDefaultPropertyIndex() | |
| getTargetEventInfo | back to summary |
|---|---|
private EventSetDescriptor[] getTargetEventInfo() throws IntrospectionException
| |
| getTargetMethodInfo | back to summary |
|---|---|
private MethodDescriptor[] getTargetMethodInfo()
| |
| getTargetPropertyInfo | back to summary |
|---|---|
private PropertyDescriptor[] getTargetPropertyInfo()
| |
| instantiate | back to summary |
|---|---|
| pack-priv static Object instantiate(Class<?> sibling, String className) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException Try to create an instance of a named class. First try the classloader of "sibling", then try the system classloader then the class loader of the current Thread.
| |
| internalFindMethod | back to summary |
|---|---|
| private static Method internalFindMethod(Class<?> start, String methodName, int argCount, Class<?>[] args) Internal support for finding a target methodName with a given parameter list on a given class. | |
| isAssignable | back to summary |
|---|---|
| private static boolean isAssignable(Class<?> current, Class<?> candidate) | |
| isEventHandler | back to summary |
|---|---|
| private boolean isEventHandler(Method m) | |
| isSubclass | back to summary |
|---|---|
| pack-priv static boolean isSubclass(Class<?> a, Class<?> b) Return true if class a is either equivalent to class b, or if class a is a subclass of class b, i.e. if a either "extends" or "implements" b. Note that either or both "Class" objects may represent interfaces. | |
| makeQualifiedMethodName | back to summary |
|---|---|
| private static String makeQualifiedMethodName(String name, String[] params) Creates a key for a method in a method cache. | |
| mergePropertyDescriptor | back to summary |
|---|---|
| private PropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd, PropertyDescriptor pd) Adds the property descriptor to the indexedproperty descriptor only if the types are the same. The most specific property descriptor will take precedence. | |
| mergePropertyDescriptor | back to summary |
|---|---|
| private PropertyDescriptor mergePropertyDescriptor(PropertyDescriptor pd1, PropertyDescriptor pd2) | |
| mergePropertyDescriptor | back to summary |
|---|---|
| private IndexedPropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1, IndexedPropertyDescriptor ipd2) | |
| mergePropertyWithIndexedProperty | back to summary |
|---|---|
| private PropertyDescriptor mergePropertyWithIndexedProperty(PropertyDescriptor pd, IndexedPropertyDescriptor ipd) | |
| processPropertyDescriptors | back to summary |
|---|---|
| private void processPropertyDescriptors() Populates the property descriptor table by merging the lists of Property descriptors. | |
| setBeanInfoSearchPath | back to summary |
|---|---|
| public static void setBeanInfoSearchPath(String[] path) Change the list of package names that will be used for finding BeanInfo classes. The behaviour of this method is undefined if parameter path is null.
| |