Java Doc for Introspector.java in  » 6.0-JDK-Core » beans » java » beans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » beans » java.beans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.beans.Introspector

Introspector
public class Introspector (Code)
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).

Because the Introspector caches BeanInfo classes for better performance, take care if you use it in an application that uses multiple class loaders. In general, when you destroy a ClassLoader that has been used to introspect classes, you should use the Introspector.flushCaches Introspector.flushCaches or Introspector.flushFromCaches Introspector.flushFromCaches method to flush all of the introspected classes out of the cache.

For more information about introspection and design patterns, please consult the JavaBeans specification.



Field Summary
final static  StringADD_PREFIX
    
final static  StringGET_PREFIX
    
final public static  intIGNORE_ALL_BEANINFO
    
final public static  intIGNORE_IMMEDIATE_BEANINFO
    
final static  StringIS_PREFIX
    
final static  StringREMOVE_PREFIX
    
final static  StringSET_PREFIX
    
final public static  intUSE_ALL_BEANINFO
    


Method Summary
public static  Stringdecapitalize(String name)
     Utility method to take a string and convert it to normal Java variable name capitalization.
static  MethodfindMethod(Class cls, String methodName, int argCount)
     Find a target methodName on a given class.
static  MethodfindMethod(Class cls, String methodName, int argCount, Class args)
     Find a target methodName with specific parameter list on a given class.

Used in the contructors of the EventSetDescriptor, PropertyDescriptor and the IndexedPropertyDescriptor.


Parameters:
  cls - The Class object on which to retrieve the method.
Parameters:
  methodName - Name of the method.
Parameters:
  argCount - Number of arguments for the desired method.
Parameters:
  args - Array of argument types for the method.

public static  voidflushCaches()
     Flush all of the Introspector's internal caches.
public static  voidflushFromCaches(Class clz)
     Flush the Introspector's internal cached information for a given class. This method is not normally required.
public static  BeanInfogetBeanInfo(Class beanClass)
     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.
Parameters:
  beanClass - The bean class to be analyzed.

public static  BeanInfogetBeanInfo(Class beanClass, int flags)
     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.
Parameters:
  beanClass - The bean class to be analyzed.
Parameters:
  flags - Flags to control the introspection.If flags == USE_ALL_BEANINFO then we use all of the BeanInfoclasses we can discover.If flags == IGNORE_IMMEDIATE_BEANINFO then we ignore anyBeanInfo associated with the specified beanClass.If flags == IGNORE_ALL_BEANINFO then we ignore all BeanInfoassociated with the specified beanClass or any of itsparent classes.

public static  BeanInfogetBeanInfo(Class beanClass, Class stopClass)
     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.
Parameters:
  beanClass - The bean class to be analyzed.
Parameters:
  stopClass - The baseclass at which to stop the analysis.

public static synchronized  String[]getBeanInfoSearchPath()
     Gets the list of package names that will be used for finding BeanInfo classes. The array of package names that will be searched inorder to find BeanInfo classes.
static  Objectinstantiate(Class sibling, String className)
     Try to create an instance of a named class.
static  booleanisSubclass(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.
public static synchronized  voidsetBeanInfoSearchPath(String path)
     Change the list of package names that will be used for finding BeanInfo classes.

Field Detail
ADD_PREFIX
final static String ADD_PREFIX(Code)



GET_PREFIX
final static String GET_PREFIX(Code)



IGNORE_ALL_BEANINFO
final public static int IGNORE_ALL_BEANINFO(Code)



IGNORE_IMMEDIATE_BEANINFO
final public static int IGNORE_IMMEDIATE_BEANINFO(Code)



IS_PREFIX
final static String IS_PREFIX(Code)



REMOVE_PREFIX
final static String REMOVE_PREFIX(Code)



SET_PREFIX
final static String SET_PREFIX(Code)



USE_ALL_BEANINFO
final public static int USE_ALL_BEANINFO(Code)





Method Detail
decapitalize
public static String decapitalize(String name)(Code)
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. The decapitalized version of the string.




findMethod
static Method findMethod(Class cls, String methodName, int argCount)(Code)
Find a target methodName on a given class.



findMethod
static Method findMethod(Class cls, String methodName, int argCount, Class args)(Code)
Find a target methodName with specific parameter list on a given class.

Used in the contructors of the EventSetDescriptor, PropertyDescriptor and the IndexedPropertyDescriptor.


Parameters:
  cls - The Class object on which to retrieve the method.
Parameters:
  methodName - Name of the method.
Parameters:
  argCount - Number of arguments for the desired method.
Parameters:
  args - Array of argument types for the method. the method or null if not found




flushCaches
public static void flushCaches()(Code)
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
public static void flushFromCaches(Class clz)(Code)
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.
Parameters:
  clz - Class object to be flushed.
throws:
  NullPointerException - If the Class object is null.



getBeanInfo
public static BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException(Code)
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.
Parameters:
  beanClass - The bean class to be analyzed. A BeanInfo object describing the target bean.
exception:
  IntrospectionException - if an exception occurs duringintrospection.
See Also:   Introspector.flushCaches
See Also:   Introspector.flushFromCaches




getBeanInfo
public static BeanInfo getBeanInfo(Class beanClass, int flags) throws IntrospectionException(Code)
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.
Parameters:
  beanClass - The bean class to be analyzed.
Parameters:
  flags - Flags to control the introspection.If flags == USE_ALL_BEANINFO then we use all of the BeanInfoclasses we can discover.If flags == IGNORE_IMMEDIATE_BEANINFO then we ignore anyBeanInfo associated with the specified beanClass.If flags == IGNORE_ALL_BEANINFO then we ignore all BeanInfoassociated with the specified beanClass or any of itsparent classes. A BeanInfo object describing the target bean.
exception:
  IntrospectionException - if an exception occurs duringintrospection.




getBeanInfo
public static BeanInfo getBeanInfo(Class beanClass, Class stopClass) throws IntrospectionException(Code)
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.
Parameters:
  beanClass - The bean class to be analyzed.
Parameters:
  stopClass - The baseclass at which to stop the analysis. Anymethods/properties/events in the stopClass or in its baseclasseswill be ignored in the analysis.
exception:
  IntrospectionException - if an exception occurs duringintrospection.




getBeanInfoSearchPath
public static synchronized String[] getBeanInfoSearchPath()(Code)
Gets the list of package names that will be used for finding BeanInfo classes. The array of package names that will be searched inorder to find BeanInfo classes. The default valuefor this array is implementation-dependent; e.g. Sun implementation initially sets to {"sun.beans.infos"}.



instantiate
static Object instantiate(Class sibling, String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException(Code)
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.



isSubclass
static boolean isSubclass(Class a, Class b)(Code)
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 tht either or both "Class" objects may represent interfaces.



setBeanInfoSearchPath
public static synchronized void setBeanInfoSearchPath(String path)(Code)
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.

First, if there is a security manager, its checkPropertiesAccess method is called. This could result in a SecurityException.
Parameters:
  path - Array of package names.
exception:
  SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow settingof system properties.
See Also:   SecurityManager.checkPropertiesAccess




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.