Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I have an API which I am turning into an internal DSL. As such, most methods in my PoJos return a reference to this so that I can chain methods together declaratively as such (syntactic sugar). myComponent .setID("MyId") .setProperty("One") .setProperty2("Two") .setAssociation(anotherComponent) .execute(); My API does not depend on Spring but I wish to make it 'Spring-Fri...
The Spring Framework API doc says: The convention used is to return the uncapitalized short name of the Class, according to JavaBeans property naming rules: So, com.myapp.Product becomes product; com.myapp.MyProduct becomes myProduct; com.myapp.UKProduct becomes UKProduct. I looked at Suns website to find a definition, but didn't find one. I wonder about a rule for names with more than o...
I'm writing an android app that requires binding a JSON object into a domain entity with the keys from the JSON as instance variables. Since there are several domain entities, each with different instance variables that the JSON needs to bind to in the app, i'd like to write a method such as ths following: Loop through all the instance variables from the domain if a key exists in the JSON wit...
I have a bean whose properties I want to access via reflection. I receive the property names in String form. The beans have getter methods for their private fields. I am currently getting the field using getDeclaredField(fieldName), making it accessible by using setAccessible(true) and then retrieving its value using get. Another way to go about it would be to capitalize the field name and ad...
I like to 'guess' attribute names from getter methods. So 'getSomeAttribute' shall be converted to 'someAttribute'. Usually I do something like String attributeName = Character.toLowerCase(methodName.indexOf(3)) + methodName.substring(4); Pretty ugly, right? I usually hide it in a method, but does anybody know a better solution?
I have several objects that look like this: class PhoneNumber { String getNumber(); String getExtension(); DateTime getLastCalled(); } class Address { String getCity(); string getState(); int getZip(); } I'd like to be able to take a List of any one of those objects and get a list of a particular property. This is a trivial operation if I were to write a function fo...
Assuming I have this class: public class MyEntity { private int id; private String name; private MyEntity(int id, String name) {this.id= id; this.name = name;} public static class MyEntityBuilder { private int id; private String name; private MyEntityBuilder setId(int id) {this.id = id;} private MyEntityBuilder setName(String name) {this.name = name;} private MyEnti...
What are the correct rules to write a JavaBean class? I'm confused because some books use MUST while other user SHOULD or COULD to describe the writing rule: i.e. a bean class MUST implements Serializable or SHOULD? the instance variables MUST be private or SHOULD BE?
I have a simple Java POJO that I would copy properties to another instance of same POJO class. I know I can do that with BeanUtils.copyProperties() but I would like to avoid use of a third-party library. So, how to do that simply, the proper and safer way ? By the way, I'm using Java 6.
How can I access a simple java object as a bean? For example: class Simple { private String foo; String getFoo() { return foo; } private void setFoo( String foo ) { this.foo = foo; } } Now I want to use this object like this: Simple simple = new Simple(); simple.setFoo( "hello" ); checkSettings( simple ); So I'm looking for the implementation of the m...
Suppose I have a handle on an object of type , and I'm told by configuration that it has a bean property of type int with the name age. How can I retrieve the getter for this document? Is there a better way than prepending "get" and capitalizing the "a" in age, and looking for a method of that name via reflection?
I have a method that looks like this public static <T extends MyClass, X extends AnotherClass> List<T> (Class<T> aParameter, X anotherParameter) Now if AnotherClass is an abstract class that does NOT Have getId defined, but every single class that extends this interface does. (Don't ask me why it is designed this why, I did not design the abstract class, and I am not allo...
I am mainly developing in .NET C# and I love the Events in C#. Im now doing som Android stuff and thus must deal with Java. When porting some code from C# to Java I ran into the problem of Events; Java does not have anything that corresponds to C# Events. So, when reading up on how Java handles "events", the only thing I can conclude is that it doesnt. There is no such thing as "events" in Ja...
Is there any standard way to access Java Bean Property like class A { private String name; public void setName(String name){ this.name = name; } public String getName(){ return this.name; } } So can I access this java bean property name using Reflection API so that when I change the value of property the methods of getName and setName are called automatically ...
I have mysterious happenings in my code. Here's the snippet from the bean: public List<HelpContentsFrag> getCFrags() { return cFrags; } public void setCFrags(List<HelpContentsFrag> frags) { cFrags = frags; } Here's the snippet from my view code (tag file) cFrags:[${topic.cFrags}] where topic is an object of the bean type. Here's the error: javax.el.PropertyNotFoundE...
On a daily basis, data is imported via a webservice. I create a new (transient) instance of a pojo which i have mapped in hibernate via JPA annotations. I populate the data from the webservice into the transient instance I load the persistient object from the database that I want to update with the data in my transient instance. I somehow merge this transient instance with the persistent one....
Is there a way to specify the String name of a property in a particular bean and return the class that the getter corresponds to?
I want to implement something similar to the JobDetailBean in spring http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/scheduling.html#scheduling-quartz-jobdetail where a map of properties can be applied to an object to set its fields. I looked through the spring source code but couldn't see how they do it. Does anybody have any ideas on how to do this ?
In java i have a bean object(type unknown) i want to put the values of members of that bean into one HashMap with class members as key.Without using reflection can i do that if so how ? otherwise tell me a good way to do it using reflection beanObject = { name="raja",age="20"} to haspMapObj = {name="raja",age="20"} As peoples you said i tried introspector: thank you for your answer and advise ...
Greetings, fellow SO users. I am currently in the process of writing a class of which instances will serve as a cache of JavaBean PropertyDescriptors. You can call a method getPropertyDescriptor(Class clazz, String propertyName) which will return the appropriate PropertyDescriptor. If it wasn't retrieved previously, the BeanInfo instance for the class is obtained and the right descriptor locat...
I am using spring in my application , When i am loading the springApplicationContext to get the beans i am getting the errors Caused by: org.springframework.beans.InvalidPropertyException: Invalid property "abc" Even though there is a property abc and the setter for that property in the bean. This is a weird error i know , but i can't figure out where is the problem. Any pointers w...
   /*
    * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    *
    * This code is free software; you can redistribute it and/or modify it
    * under the terms of the GNU General Public License version 2 only, as
    * published by the Free Software Foundation.  Sun designates this
    * particular file as subject to the "Classpath" exception as provided
    * by Sun in the LICENSE file that accompanied this code.
   *
   * This code is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   * version 2 for more details (a copy is included in the LICENSE file that
   * accompanied this code).
   *
   * You should have received a copy of the GNU General Public License version
   * 2 along with this work; if not, write to the Free Software Foundation,
   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   *
   * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   * CA 95054 USA or visit www.sun.com if you need additional information or
   * have any questions.
   */
  
  package java.beans;
  
  
  
  
  
  import java.util.Map;
  import java.util.HashMap;
  import java.util.List;
  import java.util.TreeMap;
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 or 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.

 
 
 public class Introspector {
 
     // Flags that can be used to control getBeanInfo:
     public final static int USE_ALL_BEANINFO           = 1;
     public final static int IGNORE_IMMEDIATE_BEANINFO  = 2;
     public final static int IGNORE_ALL_BEANINFO        = 3;
 
     // Static Caches to speed up introspection.
     private static Map declaredMethodCache =
         Collections.synchronizedMap(new WeakHashMap());
     private static Map beanInfoCache =
         Collections.synchronizedMap(new WeakHashMap());
 
     private Class beanClass;
     private BeanInfo explicitBeanInfo;
     private BeanInfo superBeanInfo;
     private BeanInfo additionalBeanInfo[];
 
     private boolean propertyChangeSource = false;
     private static Class eventListenerType = EventListener.class;
 
     // These should be removed.
     private String defaultEventName;
     private String defaultPropertyName;
     private int defaultEventIndex = -1;
     private int defaultPropertyIndex = -1;
 
     // Methods maps from Method objects to MethodDescriptors
     private Map methods;
 
     // properties maps from String names to PropertyDescriptors
     private Map properties;
 
     // events maps from String names to EventSetDescriptors
     private Map events;
 
     private final static String DEFAULT_INFO_PATH = "sun.beans.infos";
 
     private static String[] searchPath = {  };
 
     private final static EventSetDescriptor[] EMPTY_EVENTSETDESCRIPTORS = new EventSetDescriptor[0];
 
     static final String ADD_PREFIX = "add";
     static final String REMOVE_PREFIX = "remove";
     static final String GET_PREFIX = "get";
     static final String SET_PREFIX = "set";
     static final String IS_PREFIX = "is";
 
     private static final String BEANINFO_SUFFIX = "BeanInfo";
 
     //======================================================================
     //                          Public methods
     //======================================================================
 
    
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.
Returns:
A BeanInfo object describing the target bean.
Throws:
IntrospectionException if an exception occurs during introspection.
See also:
flushCaches()
flushFromCaches(java.lang.Class)
 
     public static BeanInfo getBeanInfo(Class<?> beanClass)
         throws IntrospectionException
     {
         if (!ReflectUtil.isPackageAccessible(beanClass)) {
             return (new Introspector(beanClassnull)).getBeanInfo();
         }
         BeanInfo bi = (BeanInfo).get(beanClass);
         if (bi == null) {
             bi = (new Introspector(beanClassnull)).getBeanInfo();
             .put(beanClassbi);
         }
         return bi;
     }

    
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.
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.
Returns:
A BeanInfo object describing the target bean.
Throws:
IntrospectionException if an exception occurs during introspection.
 
     public static BeanInfo getBeanInfo(Class<?> beanClassint flags)
                                                 throws IntrospectionException {
         return getBeanInfo(beanClassnullflags);
     }

    
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.
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.
 
     public static BeanInfo getBeanInfo(Class<?> beanClassClass<?> stopClass)
                                                 throws IntrospectionException {
         return getBeanInfo(beanClassstopClass);
     }

    
Only called from the public getBeanInfo methods. This method caches the Introspected BeanInfo based on the arguments.
 
     private static BeanInfo getBeanInfo(Class beanClassClass stopClass,
                                         int flagsthrows IntrospectionException {
         BeanInfo bi;
         if (stopClass == null && flags == ) {
             // Same parameters to take advantage of caching.
             bi = getBeanInfo(beanClass);
         } else {
             bi = (new Introspector(beanClassstopClassflags)).getBeanInfo();
         }
         return bi;
 
         // Old behaviour: Make an independent copy of the BeanInfo.
         //return new GenericBeanInfo(bi);
     }


    
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.
 
     public static String decapitalize(String name) {
         if (name == null || name.length() == 0) {
             return name;
         }
         if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
                         Character.isUpperCase(name.charAt(0))){
             return name;
         }
         char chars[] = name.toCharArray();
         chars[0] = Character.toLowerCase(chars[0]);
         return new String(chars);
     }

    
Gets the list of package names that will be used for finding BeanInfo classes.

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"}.
 
 
     public static synchronized String[] getBeanInfoSearchPath() {
         // Return a copy of the searchPath.
         String result[] = new String[.];
         for (int i = 0; i < .i++) {
             result[i] = [i];
         }
         return result;
     }

    
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.
Throws:
java.lang.SecurityException if a security manager exists and its checkPropertiesAccess method doesn't allow setting of system properties.
See also:
java.lang.SecurityManager.checkPropertiesAccess()
 
 
     public static synchronized void setBeanInfoSearchPath(String path[]) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPropertiesAccess();
         }
          = path;
     }


    
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.
 
 
     public static void flushCaches() {
         .clear();
         .clear();
     }

    
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:
java.lang.NullPointerException If the Class object is null.
 
     public static void flushFromCaches(Class<?> clz) {
         if (clz == null) {
             throw new NullPointerException();
         }
         .remove(clz);
         .remove(clz);
     }
 
     //======================================================================
     //                  Private implementation methods
     //======================================================================
 
     private Introspector(Class beanClassClass stopClassint flags)
                                             throws IntrospectionException {
         this. = beanClass;
 
         // Check stopClass is a superClass of startClass.
         if (stopClass != null) {
             boolean isSuper = false;
             for (Class c = beanClass.getSuperclass(); c != nullc = c.getSuperclass()) {
                 if (c == stopClass) {
                     isSuper = true;
                 }
             }
             if (!isSuper) {
                 throw new IntrospectionException(stopClass.getName() + " not superclass of " +
                                         beanClass.getName());
             }
         }
 
         if (flags == ) {
              = findExplicitBeanInfo(beanClass);
         }
 
         Class superClass = beanClass.getSuperclass();
         if (superClass != stopClass) {
             int newFlags = flags;
             if (newFlags == ) {
                 newFlags = ;
             }
              = getBeanInfo(superClassstopClassnewFlags);
         }
         if ( != null) {
         }
         if ( == null) {
              = new BeanInfo[0];
         }
     }

    
Constructs a GenericBeanInfo class from the state of the Introspector
 
     private BeanInfo getBeanInfo() throws IntrospectionException {
 
         // the evaluation order here is import, as we evaluate the
         // event sets and locate PropertyChangeListeners before we
         // look for properties.
         BeanDescriptor bd = getTargetBeanDescriptor();
         MethodDescriptor mds[] = getTargetMethodInfo();
         EventSetDescriptor esds[] = getTargetEventInfo();
         PropertyDescriptor pds[] = getTargetPropertyInfo();
 
         int defaultEvent = getTargetDefaultEventIndex();
         int defaultProperty = getTargetDefaultPropertyIndex();
 
         return new GenericBeanInfo(bdesdsdefaultEventpds,
                         defaultPropertymds);
 
     }

    
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.

Returns:
Instance of an explicit BeanInfo class or null if one isn't found.
 
     private static synchronized BeanInfo findExplicitBeanInfo(Class beanClass) {
         String name = beanClass.getName() + ;
         try {
             return (java.beans.BeanInfo)instantiate(beanClassname);
         } catch (Exception ex) {
             // Just drop through
 
         }
         // Now try checking if the bean is its own BeanInfo.
         try {
             if (isSubclass(beanClassjava.beans.BeanInfo.class)) {
                 return (java.beans.BeanInfo)beanClass.newInstance();
             }
         } catch (Exception ex) {
             // Just drop through
         }
         // Now try looking for <searchPath>.fooBeanInfo
         name = name.substring(name.lastIndexOf('.')+1);
 
         for (int i = 0; i < .i++) {
             // This optimization will only use the BeanInfo search path if is has changed
             // from the original or trying to get the ComponentBeanInfo.
             if (!.equals([i]) ||
                 .equals([i]) && "ComponentBeanInfo".equals(name)) {
                 try {
                     String fullName = [i] + "." + name;
                     java.beans.BeanInfo bi = (java.beans.BeanInfo)instantiate(beanClassfullName);
 
                     // Make sure that the returned BeanInfo matches the class.
                     if (bi.getBeanDescriptor() != null) {
                         if (bi.getBeanDescriptor().getBeanClass() == beanClass) {
                             return bi;
                         }
                     } else if (bi.getPropertyDescriptors() != null) {
                         PropertyDescriptor[] pds = bi.getPropertyDescriptors();
                         for (int j = 0; j < pds.lengthj++) {
                             Method method = pds[j].getReadMethod();
                             if (method == null) {
                                 method = pds[j].getWriteMethod();
                             }
                             if (method != null && method.getDeclaringClass() == beanClass) {
                                 return bi;
                             }
                         }
                     } else if (bi.getMethodDescriptors() != null) {
                         MethodDescriptor[] mds = bi.getMethodDescriptors();
                         for (int j = 0; j < mds.lengthj++) {
                             Method method = mds[j].getMethod();
                             if (method != null && method.getDeclaringClass() == beanClass) {
                                 return bi;
                             }
                         }
                     }
                 } catch (Exception ex) {
                     // Silently ignore any errors.
                 }
             }
         }
         return null;
     }

    

Returns:
An array of PropertyDescriptors describing the editable properties supported by the target bean.
 
 
     private PropertyDescriptor[] getTargetPropertyInfo() {
 
         // Check if the bean has its own BeanInfo that will provide
         // explicit information.
         PropertyDescriptor[] explicitProperties = null;
         if ( != null) {
             explicitProperties = getPropertyDescriptors(this.);
         }
 
         if (explicitProperties == null &&  != null) {
             // We have no explicit BeanInfo properties.  Check with our parent.
         }
 
         for (int i = 0; i < .i++) {
         }
 
         if (explicitProperties != null) {
             // Add the explicit BeanInfo data to our results.
             addPropertyDescriptors(explicitProperties);
 
         } else {
 
             // Apply some reflection to the current class.
 
             // First get an array of all the public methods at this level
             Method methodList[] = getPublicDeclaredMethods();
 
             // Now analyze each method.
             for (int i = 0; i < methodList.lengthi++) {
                 Method method = methodList[i];
                 if (method == null || method.isSynthetic()) {
                     continue;
                 }
                 // skip static methods.
                 int mods = method.getModifiers();
                 if (Modifier.isStatic(mods)) {
                     continue;
                 }
                 String name = method.getName();
                 Class argTypes[] = method.getParameterTypes();
                 Class resultType = method.getReturnType();
                 int argCount = argTypes.length;
                 PropertyDescriptor pd = null;
 
                 if (name.length() <= 3 && !name.startsWith()) {
                     // Optimization. Don't bother with invalid propertyNames.
                     continue;
                 }
 
                 try {
 
                     if (argCount == 0) {
                         if (name.startsWith()) {
                             // Simple getter
                             pd = new PropertyDescriptor(this.name.substring(3), methodnull);
                         } else if (resultType == boolean.class && name.startsWith()) {
                             // Boolean getter
                             pd = new PropertyDescriptor(this.name.substring(2), methodnull);
                         }
                     } else if (argCount == 1) {
                         if (argTypes[0] == int.class && name.startsWith()) {
                             pd = new IndexedPropertyDescriptor(this.name.substring(3), nullnullmethodnull);
                         } else if (resultType == void.class && name.startsWith()) {
                             // Simple setter
                             pd = new PropertyDescriptor(this.name.substring(3), nullmethod);
                             if (throwsException(methodPropertyVetoException.class)) {
                                 pd.setConstrained(true);
                             }
                         }
                     } else if (argCount == 2) {
                             if (argTypes[0] == int.class && name.startsWith()) {
                             pd = new IndexedPropertyDescriptor(this.name.substring(3), nullnullnullmethod);
                             if (throwsException(methodPropertyVetoException.class)) {
                                 pd.setConstrained(true);
                             }
                         }
                     }
                 } catch (IntrospectionException ex) {
                     // This happens if a PropertyDescriptor or IndexedPropertyDescriptor
                     // constructor fins that the method violates details of the deisgn
                     // pattern, e.g. by having an empty name, or a getter returning
                     // void , or whatever.
                     pd = null;
                 }
 
                 if (pd != null) {
                     // If this class or one of its base classes is a PropertyChange
                     // source, then we assume that any properties we discover are "bound".
                     if () {
                         pd.setBound(true);
                     }
                     addPropertyDescriptor(pd);
                 }
             }
         }
         processPropertyDescriptors();
 
         // Allocate and populate the result array.
         PropertyDescriptor result[] = new PropertyDescriptor[.size()];
         result = (PropertyDescriptor[]).values().toArray(result);
 
         // Set the default index.
         if ( != null) {
             for (int i = 0; i < result.lengthi++) {
                 if (.equals(result[i].getName())) {
                      = i;
                 }
             }
         }
 
         return result;
     }
 
     private HashMap pdStore = new HashMap();

    
Adds the property descriptor to the list store.
 
     private void addPropertyDescriptor(PropertyDescriptor pd) {
         String propName = pd.getName();
         List list = (List).get(propName);
         if (list == null) {
             list = new ArrayList();
             .put(propNamelist);
         }
         if (this. != pd.getClass0()) {
             // replace existing property descriptor
             // only if we have types to resolve
             // in the context of this.beanClass
             try {
                 String name = pd.getName();
                 Method read = pd.getReadMethod();
                 Method write = pd.getWriteMethod();
                 boolean cls = true;
                 if (read != nullcls = cls && read.getGenericReturnType() instanceof Class;
                 if (write != nullcls = cls && write.getGenericParameterTypes()[0] instanceof Class;
                 if (pd instanceof IndexedPropertyDescriptor) {
                     IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor)pd;
                     Method readI = ipd.getIndexedReadMethod();
                     Method writeI = ipd.getIndexedWriteMethod();
                     if (readI != nullcls = cls && readI.getGenericReturnType() instanceof Class;
                     if (writeI != nullcls = cls && writeI.getGenericParameterTypes()[1] instanceof Class;
                     if (!cls) {
                         pd = new IndexedPropertyDescriptor(this.namereadwritereadIwriteI);
                     }
                 } else if (!cls) {
                     pd = new PropertyDescriptor(this.namereadwrite);
                 }
             } catch ( IntrospectionException e ) {
             }
         }
         list.add(pd);
     }
 
     private void addPropertyDescriptors(PropertyDescriptor[] descriptors) {
         if (descriptors != null) {
             for (PropertyDescriptor descriptor : descriptors) {
                 addPropertyDescriptor(descriptor);
             }
         }
     }
 
     private PropertyDescriptor[] getPropertyDescriptors(BeanInfo info) {
         PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
         int index = info.getDefaultPropertyIndex();
         if ((0 <= index) && (index < descriptors.length)) {
             this. = descriptors[index].getName();
         }
         return descriptors;
     }

    
Populates the property descriptor table by merging the lists of Property descriptors.
 
     private void processPropertyDescriptors() {
         if ( == null) {
              = new TreeMap();
         }
 
         List list;
 
         PropertyDescriptor pdgpdspd;
         IndexedPropertyDescriptor ipdigpdispd;
 
         Iterator it = .values().iterator();
         while (it.hasNext()) {
             pd = nullgpd = nullspd = null;
             ipd = nulligpd = nullispd = null;
 
             list = (List)it.next();
 
             // First pass. Find the latest getter method. Merge properties
             // of previous getter methods.
             for (int i = 0; i < list.size(); i++) {
                 pd = (PropertyDescriptor)list.get(i);
                 if (pd instanceof IndexedPropertyDescriptor) {
                     ipd = (IndexedPropertyDescriptor)pd;
                     if (ipd.getIndexedReadMethod() != null) {
                         if (igpd != null) {
                             igpd = new IndexedPropertyDescriptor(igpdipd);
                         } else {
                             igpd = ipd;
                         }
                     }
                 } else {
                     if (pd.getReadMethod() != null) {
                         if (gpd != null) {
                             // Don't replace the existing read
                             // method if it starts with "is"
                             Method method = gpd.getReadMethod();
                             if (!method.getName().startsWith()) {
                                 gpd = new PropertyDescriptor(gpdpd);
                             }
                         } else {
                             gpd = pd;
                         }
                     }
                 }
             }
 
             // Second pass. Find the latest setter method which
             // has the same type as the getter method.
             for (int i = 0; i < list.size(); i++) {
                 pd = (PropertyDescriptor)list.get(i);
                 if (pd instanceof IndexedPropertyDescriptor) {
                     ipd = (IndexedPropertyDescriptor)pd;
                     if (ipd.getIndexedWriteMethod() != null) {
                         if (igpd != null) {
                             if (igpd.getIndexedPropertyType()
                                 == ipd.getIndexedPropertyType()) {
                                 if (ispd != null) {
                                     ispd = new IndexedPropertyDescriptor(ispdipd);
                                 } else {
                                     ispd = ipd;
                                 }
                             }
                         } else {
                             if (ispd != null) {
                                 ispd = new IndexedPropertyDescriptor(ispdipd);
                             } else {
                                 ispd = ipd;
                             }
                         }
                     }
                 } else {
                     if (pd.getWriteMethod() != null) {
                         if (gpd != null) {
                             if (gpd.getPropertyType() == pd.getPropertyType()) {
                                 if (spd != null) {
                                     spd = new PropertyDescriptor(spdpd);
                                 } else {
                                     spd = pd;
                                 }
                             }
                         } else {
                             if (spd != null) {
                                 spd = new PropertyDescriptor(spdpd);
                             } else {
                                 spd = pd;
                             }
                         }
                     }
                 }
             }
 
             // At this stage we should have either PDs or IPDs for the
             // representative getters and setters. The order at which the
             // property descriptors are determined represent the
             // precedence of the property ordering.
             pd = nullipd = null;
 
             if (igpd != null && ispd != null) {
                 // Complete indexed properties set
                 // Merge any classic property descriptors
                 if (gpd != null) {
                     PropertyDescriptor tpd = mergePropertyDescriptor(igpdgpd);
                     if (tpd instanceof IndexedPropertyDescriptor) {
                         igpd = (IndexedPropertyDescriptor)tpd;
                     }
                 }
                 if (spd != null) {
                     PropertyDescriptor tpd = mergePropertyDescriptor(ispdspd);
                     if (tpd instanceof IndexedPropertyDescriptor) {
                         ispd = (IndexedPropertyDescriptor)tpd;
                     }
                 }
                 if (igpd == ispd) {
                     pd = igpd;
                 } else {
                     pd = mergePropertyDescriptor(igpdispd);
                 }
             } else if (gpd != null && spd != null) {
                 // Complete simple properties set
                 if (gpd == spd) {
                     pd = gpd;
                 } else {
                     pd = mergePropertyDescriptor(gpdspd);
                 }
             } else if (ispd != null) {
                 // indexed setter
                 pd = ispd;
                 // Merge any classic property descriptors
                 if (spd != null) {
                     pd = mergePropertyDescriptor(ispdspd);
                 }
                 if (gpd != null) {
                     pd = mergePropertyDescriptor(ispdgpd);
                 }
             } else if (igpd != null) {
                 // indexed getter
                 pd = igpd;
                 // Merge any classic property descriptors
                 if (gpd != null) {
                     pd = mergePropertyDescriptor(igpdgpd);
                 }
                 if (spd != null) {
                     pd = mergePropertyDescriptor(igpdspd);
                 }
             } else if (spd != null) {
                 // simple setter
                 pd = spd;
             } else if (gpd != null) {
                 // simple getter
                 pd = gpd;
             }
 
             // Very special case to ensure that an IndexedPropertyDescriptor
             // doesn't contain less information than the enclosed
             // PropertyDescriptor. If it does, then recreate as a
             // PropertyDescriptor. See 4168833
             if (pd instanceof IndexedPropertyDescriptor) {
                 ipd = (IndexedPropertyDescriptor)pd;
                 if (ipd.getIndexedReadMethod() == null && ipd.getIndexedWriteMethod() == null) {
                     pd = new PropertyDescriptor(ipd);
                 }
             }
 
             // Find the first property descriptor
             // which does not have getter and setter methods.
             // See regression bug 4984912.
             if ( (pd == null) && (list.size() > 0) ) {
                 pd = (PropertyDescriptorlist.get(0);
             }
 
             if (pd != null) {
                 .put(pd.getName(), pd);
             }
         }
     }

    
Adds the property descriptor to the indexedproperty descriptor only if the types are the same. The most specific property descriptor will take precedence.
 
                                                        PropertyDescriptor pd) {
         PropertyDescriptor result = null;
 
         Class propType = pd.getPropertyType();
         Class ipropType = ipd.getIndexedPropertyType();
 
         if (propType.isArray() && propType.getComponentType() == ipropType) {
             if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
                 result = new IndexedPropertyDescriptor(pdipd);
             } else {
                 result = new IndexedPropertyDescriptor(ipdpd);
             }
         } else {
             // Cannot merge the pd because of type mismatch
             // Return the most specific pd
             if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
                 result = ipd;
             } else {
                 result = pd;
                 // Try to add methods which may have been lost in the type change
                 // See 4168833
                 Method write = result.getWriteMethod();
                 Method read = result.getReadMethod();
 
                 if (read == null && write != null) {
                     read = findMethod(result.getClass0(),
                                        + NameGenerator.capitalize(result.getName()), 0);
                     if (read != null) {
                         try {
                             result.setReadMethod(read);
                         } catch (IntrospectionException ex) {
                             // no consequences for failure.
                         }
                     }
                 }
                 if (write == null && read != null) {
                     write = findMethod(result.getClass0(),
                                         + NameGenerator.capitalize(result.getName()), 1,
                                        new Class[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
                     if (write != null) {
                         try {
                             result.setWriteMethod(write);
                         } catch (IntrospectionException ex) {
                             // no consequences for failure.
                         }
                     }
                 }
             }
         }
         return result;
     }
 
     // Handle regular pd merge
                                                        PropertyDescriptor pd2) {
         if (pd1.getClass0().isAssignableFrom(pd2.getClass0())) {
             return new PropertyDescriptor(pd1pd2);
         } else {
             return new PropertyDescriptor(pd2pd1);
         }
     }
 
     // Handle regular ipd merge
                                                        IndexedPropertyDescriptor ipd2) {
         if (ipd1.getClass0().isAssignableFrom(ipd2.getClass0())) {
             return new IndexedPropertyDescriptor(ipd1ipd2);
         } else {
             return new IndexedPropertyDescriptor(ipd2ipd1);
         }
     }

    

Returns:
An array of EventSetDescriptors describing the kinds of events fired by the target bean.
 
         if ( == null) {
              = new HashMap();
         }
 
         // Check if the bean has its own BeanInfo that will provide
         // explicit information.
         EventSetDescriptor[] explicitEvents = null;
         if ( != null) {
             explicitEvents = .getEventSetDescriptors();
             int ix = .getDefaultEventIndex();
             if (ix >= 0 && ix < explicitEvents.length) {
                  = explicitEvents[ix].getName();
             }
         }
 
         if (explicitEvents == null &&  != null) {
             // We have no explicit BeanInfo events.  Check with our parent.
             EventSetDescriptor supers[] = .getEventSetDescriptors();
             for (int i = 0 ; i < supers.lengthi++) {
                 addEvent(supers[i]);
             }
             int ix = .getDefaultEventIndex();
             if (ix >= 0 && ix < supers.length) {
                  = supers[ix].getName();
             }
         }
 
         for (int i = 0; i < .i++) {
             EventSetDescriptor additional[] = [i].getEventSetDescriptors();
             if (additional != null) {
                 for (int j = 0 ; j < additional.lengthj++) {
                     addEvent(additional[j]);
                 }
             }
         }
 
         if (explicitEvents != null) {
             // Add the explicit explicitBeanInfo data to our results.
             for (int i = 0 ; i < explicitEvents.lengthi++) {
                 addEvent(explicitEvents[i]);
             }
 
         } else {
 
             // Apply some reflection to the current class.
 
             // Get an array of all the public beans methods at this level
             Method methodList[] = getPublicDeclaredMethods();
 
             // Find all suitable "add", "remove" and "get" Listener methods
             // The name of the listener type is the key for these hashtables
             // i.e, ActionListener
             Map adds = null;
             Map removes = null;
             Map gets = null;
 
             for (int i = 0; i < methodList.lengthi++) {
                 Method method = methodList[i];
                 if (method == null) {
                     continue;
                 }
                 // skip static methods.
                 int mods = method.getModifiers();
                 if (Modifier.isStatic(mods)) {
                     continue;
                 }
                 String name = method.getName();
                 // Optimization avoid getParameterTypes
                 if (!name.startsWith() && !name.startsWith()
                    && !name.startsWith()) {
                    continue;
                }
                Class argTypes[] = FeatureDescriptor.getParameterTypes(method);
                Class resultType = FeatureDescriptor.getReturnType(method);
                if (name.startsWith() && argTypes.length == 1 &&
                    resultType == . &&
                    Introspector.isSubclass(argTypes[0], )) {
                    String listenerName = name.substring(3);
                    if (listenerName.length() > 0 &&
                        argTypes[0].getName().endsWith(listenerName)) {
                        if (adds == null) {
                            adds = new HashMap();
                        }
                        adds.put(listenerNamemethod);
                    }
                }
                else if (name.startsWith() && argTypes.length == 1 &&
                         resultType == . &&
                         Introspector.isSubclass(argTypes[0], )) {
                    String listenerName = name.substring(6);
                    if (listenerName.length() > 0 &&
                        argTypes[0].getName().endsWith(listenerName)) {
                        if (removes == null) {
                            removes = new HashMap();
                        }
                        removes.put(listenerNamemethod);
                    }
                }
                else if (name.startsWith() && argTypes.length == 0 &&
                         resultType.isArray() &&
                         Introspector.isSubclass(resultType.getComponentType(),
                                                 )) {
                    String listenerName  = name.substring(3, name.length() - 1);
                    if (listenerName.length() > 0 &&
                        resultType.getComponentType().getName().endsWith(listenerName)) {
                        if (gets == null) {
                            gets = new HashMap();
                        }
                        gets.put(listenerNamemethod);
                    }
                }
            }
            if (adds != null && removes != null) {
                // Now look for matching addFooListener+removeFooListener pairs.
                // Bonus if there is a matching getFooListeners method as well.
                Iterator keys = adds.keySet().iterator();
                while (keys.hasNext()) {
                    String listenerName = (Stringkeys.next();
                    // Skip any "add" which doesn't have a matching "remove" or
                    // a listener name that doesn't end with Listener
                    if (removes.get(listenerName) == null || !listenerName.endsWith("Listener")) {
                        continue;
                    }
                    String eventName = decapitalize(listenerName.substring(0, listenerName.length()-8));
                    Method addMethod = (Method)adds.get(listenerName);
                    Method removeMethod = (Method)removes.get(listenerName);
                    Method getMethod = null;
                    if (gets != null) {
                        getMethod = (Method)gets.get(listenerName);
                    }
                    Class argType = FeatureDescriptor.getParameterTypes(addMethod)[0];
                    // generate a list of Method objects for each of the target methods:
                    Method allMethods[] = getPublicDeclaredMethods(argType);
                    List validMethods = new ArrayList(allMethods.length);
                    for (int i = 0; i < allMethods.lengthi++) {
                        if (allMethods[i] == null) {
                            continue;
                        }
                        if (isEventHandler(allMethods[i])) {
                            validMethods.add(allMethods[i]);
                        }
                    }
                    Method[] methods = (Method[])validMethods.toArray(new Method[validMethods.size()]);
                    EventSetDescriptor esd = new EventSetDescriptor(eventNameargType,
                                                                    methodsaddMethod,
                                                                    removeMethod,
                                                                    getMethod);
                    // If the adder method throws the TooManyListenersException then it
                    // is a Unicast event source.
                    if (throwsException(addMethod,
                                        java.util.TooManyListenersException.class)) {
                        esd.setUnicast(true);
                    }
                    addEvent(esd);
                }
            } // if (adds != null ...
        }
        EventSetDescriptor[] result;
        if (.size() == 0) {
            result = ;
        } else {
            // Allocate and populate the result array.
            result = new EventSetDescriptor[.size()];
            result = (EventSetDescriptor[]).values().toArray(result);
            // Set the default index.
            if ( != null) {
                for (int i = 0; i < result.lengthi++) {
                    if (.equals(result[i].getName())) {
                         = i;
                    }
                }
            }
        }
        return result;
    }
    private void addEvent(EventSetDescriptor esd) {
        String key = esd.getName();
        if (esd.getName().equals("propertyChange")) {
             = true;
        }
        EventSetDescriptor old = (EventSetDescriptor).get(key);
        if (old == null) {
            .put(keyesd);
            return;
        }
        EventSetDescriptor composite = new EventSetDescriptor(oldesd);
        .put(keycomposite);
    }

    

Returns:
An array of MethodDescriptors describing the private methods supported by the target bean.
    private MethodDescriptor[] getTargetMethodInfo() {
        if ( == null) {
             = new HashMap(100);
        }
        // Check if the bean has its own BeanInfo that will provide
        // explicit information.
        MethodDescriptor[] explicitMethods = null;
        if ( != null) {
            explicitMethods = .getMethodDescriptors();
        }
        if (explicitMethods == null &&  != null) {
            // We have no explicit BeanInfo methods.  Check with our parent.
            MethodDescriptor supers[] = .getMethodDescriptors();
            for (int i = 0 ; i < supers.lengthi++) {
                addMethod(supers[i]);
            }
        }
        for (int i = 0; i < .i++) {
            MethodDescriptor additional[] = [i].getMethodDescriptors();
            if (additional != null) {
                for (int j = 0 ; j < additional.lengthj++) {
                    addMethod(additional[j]);
                }
            }
        }
        if (explicitMethods != null) {
            // Add the explicit explicitBeanInfo data to our results.
            for (int i = 0 ; i < explicitMethods.lengthi++) {
                addMethod(explicitMethods[i]);
            }
        } else {
            // Apply some reflection to the current class.
            // First get an array of all the beans methods at this level
            Method methodList[] = getPublicDeclaredMethods();
            // Now analyze each method.
            for (int i = 0; i < methodList.lengthi++) {
                Method method = methodList[i];
                if (method == null) {
                    continue;
                }
                MethodDescriptor md = new MethodDescriptor(method);
                addMethod(md);
            }
        }
        // Allocate and populate the result array.
        MethodDescriptor result[] = new MethodDescriptor[.size()];
        result = (MethodDescriptor[]).values().toArray(result);
        return result;
    }
    private void addMethod(MethodDescriptor md) {
        // We have to be careful here to distinguish method by both name
        // and argument lists.
        // This method gets called a *lot, so we try to be efficient.
        String name = md.getName();
        MethodDescriptor old = (MethodDescriptor).get(name);
        if (old == null) {
            // This is the common case.
            .put(namemd);
            return;
        }
        // We have a collision on method names.  This is rare.
        // Check if old and md have the same type.
        String[] p1 = md.getParamNames();
        String[] p2 = old.getParamNames();
        boolean match = false;
        if (p1.length == p2.length) {
            match = true;
            for (int i = 0; i < p1.lengthi++) {
                if (p1[i] != p2[i]) {
                    match = false;
                    break;
                }
            }
        }
        if (match) {
            MethodDescriptor composite = new MethodDescriptor(oldmd);
            .put(namecomposite);
            return;
        }
        // We have a collision on method names with different type signatures.
        // This is very rare.
        String longKey = makeQualifiedMethodName(namep1);
        old = (MethodDescriptor).get(longKey);
        if (old == null) {
            .put(longKeymd);
            return;
        }
        MethodDescriptor composite = new MethodDescriptor(oldmd);
        .put(longKeycomposite);
    }

    
Creates a key for a method in a method cache.
    private static String makeQualifiedMethodName(String nameString[] params) {
        StringBuffer sb = new StringBuffer(name);
        sb.append('=');
        for (int i = 0; i < params.lengthi++) {
            sb.append(':');
            sb.append(params[i]);
        }
        return sb.toString();
    }
    private int getTargetDefaultEventIndex() {
        return ;
    }
    private int getTargetDefaultPropertyIndex() {
        return ;
    }
        // Use explicit info, if available,
        if ( != null) {
            BeanDescriptor bd = .getBeanDescriptor();
            if (bd != null) {
                return (bd);
            }
        }
        // OK, fabricate a default BeanDescriptor.
        return (new BeanDescriptor());
    }
    private boolean isEventHandler(Method m) {
        // We assume that a method is an event handler if it has a single
        // argument, whose type inherit from java.util.Event.
        Class argTypes[] = FeatureDescriptor.getParameterTypes(m);
        if (argTypes.length != 1) {
            return false;
        }
        if (isSubclass(argTypes[0], java.util.EventObject.class)) {
            return true;
        }
        return false;
    }
    /*
     * Internal method to return *public* methods within a class.
     */
    private static synchronized Method[] getPublicDeclaredMethods(Class clz) {
        // Looking up Class.getDeclaredMethods is relatively expensive,
        // so we cache the results.
        Method[] result = null;
        if (!ReflectUtil.isPackageAccessible(clz)) {
            return new Method[0];
        }
        final Class fclz = clz;
        Reference ref = (Reference).get(fclz);
        if (ref != null) {
            result = (Method[])ref.get();
            if (result != null) {
                return result;
            }
        }
        // We have to raise privilege for getDeclaredMethods
        result = (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    return fclz.getDeclaredMethods();
                }
            });
        // Null out any non-public methods.
        for (int i = 0; i < result.lengthi++) {
            Method method = result[i];
            int mods = method.getModifiers();
            if (!Modifier.isPublic(mods)) {
                result[i] = null;
            }
        }
        // Add it to the cache.
        .put(fclznew SoftReference(result));
        return result;
    }
    //======================================================================
    // Package private support methods.
    //======================================================================

    
Internal support for finding a target methodName with a given parameter list on a given class.
    private static Method internalFindMethod(Class startString methodName,
                                                 int argCountClass args[]) {
        // For overriden methods we need to find the most derived version.
        // So we start with the given class and walk up the superclass chain.
        Method method = null;
        for (Class cl = startcl != nullcl = cl.getSuperclass()) {
            Method methods[] = getPublicDeclaredMethods(cl);
            for (int i = 0; i < methods.lengthi++) {
                method = methods[i];
                if (method == null) {
                    continue;
                }
                // make sure method signature matches.
                Class params[] = FeatureDescriptor.getParameterTypes(startmethod);
                if (method.getName().equals(methodName) &&
                    params.length == argCount) {
                    if (args != null) {
                        boolean different = false;
                        if (argCount > 0) {
                            for (int j = 0; j < argCountj++) {
                                if (params[j] != args[j]) {
                                    different = true;
                                    continue;
                                }
                            }
                            if (different) {
                                continue;
                            }
                        }
                    }
                    return method;
                }
            }
        }
        method = null;
        // Now check any inherited interfaces.  This is necessary both when
        // the argument class is itself an interface, and when the argument
        // class is an abstract class.
        Class ifcs[] = start.getInterfaces();
        for (int i = 0 ; i < ifcs.lengthi++) {
            // Note: The original implementation had both methods calling
            // the 3 arg method. This is preserved but perhaps it should
            // pass the args array instead of null.
            method = internalFindMethod(ifcs[i], methodNameargCountnull);
            if (method != null) {
                break;
            }
        }
        return method;
    }

    
Find a target methodName on a given class.
    static Method findMethod(Class clsString methodNameint argCount) {
        return findMethod(clsmethodNameargCountnull);
    }

    
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.
methodName Name of the method.
argCount Number of arguments for the desired method.
args Array of argument types for the method.
Returns:
the method or null if not found
    static Method findMethod(Class clsString methodNameint argCount,
                             Class args[]) {
        if (methodName == null) {
            return null;
        }
        return internalFindMethod(clsmethodNameargCountargs);
    }

    
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.
    static  boolean isSubclass(Class aClass b) {
        // We rely on the fact that for any given java class or
        // primtitive type there is a unqiue Class object, so
        // we can use object equivalence in the comparisons.
        if (a == b) {
            return true;
        }
        if (a == null || b == null) {
            return false;
        }
        for (Class x = ax != nullx = x.getSuperclass()) {
            if (x == b) {
                return true;
            }
            if (b.isInterface()) {
                Class interfaces[] = x.getInterfaces();
                for (int i = 0; i < interfaces.lengthi++) {
                    if (isSubclass(interfaces[i], b)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    
Return true iff the given method throws the given exception.
    private boolean throwsException(Method methodClass exception) {
        Class exs[] = method.getExceptionTypes();
        for (int i = 0; i < exs.lengthi++) {
            if (exs[i] == exception) {
                return true;
            }
        }
        return false;
    }


    
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.
    static Object instantiate(Class siblingString className)
                 throws InstantiationExceptionIllegalAccessException,
                                                ClassNotFoundException {
        // First check with sibling's classloader (if any).
        ClassLoader cl = sibling.getClassLoader();
        Class cls = ClassFinder.findClass(classNamecl);
        return cls.newInstance();
    }
// end class Introspector
//===========================================================================
Package private implementation support class for Introspector's internal use.

Mostly this is used as a placeholder for the descriptors.

    private EventSetDescriptor[] events;
    private int defaultEvent;
    private PropertyDescriptor[] properties;
    private int defaultProperty;
    private MethodDescriptor[] methods;
    private BeanInfo targetBeanInfo;
    public GenericBeanInfo(BeanDescriptor beanDescriptor,
                EventSetDescriptor[] eventsint defaultEvent,
                PropertyDescriptor[] propertiesint defaultProperty,
                MethodDescriptor[] methodsBeanInfo targetBeanInfo) {
        this. = beanDescriptor;
        this. = events;
        this. = defaultEvent;
        this. = properties;
        this. = defaultProperty;
        this. = methods;
        this. = targetBeanInfo;
    }

    
Package-private dup constructor This must isolate the new object from any changes to the old object.
         = new BeanDescriptor(old.beanDescriptor);
        if (old.events != null) {
            int len = old.events.length;
             = new EventSetDescriptor[len];
            for (int i = 0; i < leni++) {
                [i] = new EventSetDescriptor(old.events[i]);
            }
        }
         = old.defaultEvent;
        if (old.properties != null) {
            int len = old.properties.length;
             = new PropertyDescriptor[len];
            for (int i = 0; i < leni++) {
                PropertyDescriptor oldp = old.properties[i];
                if (oldp instanceof IndexedPropertyDescriptor) {
                    [i] = new IndexedPropertyDescriptor(
                                        (IndexedPropertyDescriptoroldp);
                } else {
                    [i] = new PropertyDescriptor(oldp);
                }
            }
        }
         = old.defaultProperty;
        if (old.methods != null) {
            int len = old.methods.length;
             = new MethodDescriptor[len];
            for (int i = 0; i < leni++) {
                [i] = new MethodDescriptor(old.methods[i]);
            }
        }
         = old.targetBeanInfo;
    }
        return ;
    }
    public int getDefaultPropertyIndex() {
        return ;
    }
        return ;
    }
    public int getDefaultEventIndex() {
        return ;
    }
        return ;
    }
        return ;
    }
    public java.awt.Image getIcon(int iconKind) {
        if ( != null) {
            return .getIcon(iconKind);
        }
        return super.getIcon(iconKind);
    }
New to GrepCode? Check out our FAQ X