|
Bali Share 1.1.18 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.bali.share.beans.JavaIntrospector
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).
This class differs from the standard Introspector in the following ways:
Field Summary | |
static int |
IGNORE_ALL_BEANINFO
|
static int |
IGNORE_IMMEDIATE_BEANINFO
|
static int |
USE_ALL_BEANINFO
|
Method Summary | |
static java.lang.String |
decapitalize(java.lang.String name)
Utility method to take a string and convert it to normal Java variable name capitalization. |
static void |
flushCaches()
Flush all of the Introspector's internal caches. |
static void |
flushFromCaches(java.lang.Class targetClass)
Flush the Introspector's internal cached information for a given class. |
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class beanClass)
Introspect on a Java bean and learn about all its properties, exposed methods, and events. |
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class beanClass,
java.lang.Class stopClass)
Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point. |
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class beanClass,
int flags)
Introspect on a Java bean and learn about all its properties, exposed methods, and events, subnject to some comtrol flags. |
static java.lang.String[] |
getBeanInfoSearchPath()
|
static void |
setBeanInfoSearchPath(java.lang.String[] path)
Change the list of package names that will be used for finding BeanInfo classes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int USE_ALL_BEANINFO
public static final int IGNORE_IMMEDIATE_BEANINFO
public static final int IGNORE_ALL_BEANINFO
Method Detail |
public static java.beans.BeanInfo getBeanInfo(java.lang.Class beanClass) throws java.beans.IntrospectionException
beanClass
- The bean class to be analyzed.java.beans.IntrospectionException
- if an exception occurs during
introspection.public static java.beans.BeanInfo getBeanInfo(java.lang.Class beanClass, int flags) throws java.beans.IntrospectionException
beanClass
- The bean class to be analyzed.flags
- 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.java.beans.IntrospectionException
- if an exception occurs during
introspection.public static java.beans.BeanInfo getBeanInfo(java.lang.Class beanClass, java.lang.Class stopClass) throws java.beans.IntrospectionException
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.java.beans.IntrospectionException
- if an exception occurs during
introspection.public static java.lang.String decapitalize(java.lang.String name)
Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".
name
- The string to be decapitalized.public static java.lang.String[] getBeanInfoSearchPath()
This is initially set to {"sun.beans.infos"}.
public static void setBeanInfoSearchPath(java.lang.String[] path)
path
- Array of package names.public static void flushCaches()
public static void flushFromCaches(java.lang.Class targetClass)
targetClass
- Class object to be flushed.
|
Bali Share 1.1.18 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |