List of usage examples for java.beans BeanInfo getPropertyDescriptors
PropertyDescriptor[] getPropertyDescriptors();
From source file:gov.nih.nci.cabig.caaers.domain.expeditedfields.ExpeditedReportTreeTest.java
@SuppressWarnings({ "RawUseOfParameterizedType" }) private void assertChildPropertiesExist(TreeNode node, Class nodePropertyClass) throws IntrospectionException { BeanInfo beanInfo = Introspector.getBeanInfo(nodePropertyClass); for (TreeNode child : node.getChildren()) { String childPropName = child.getPropertyName(); if (childPropName == null) { // this child does not map to a property -- push down assertChildPropertiesExist(child, nodePropertyClass); } else {// w w w. j av a2s . co m if (childPropName.indexOf('[') >= 0) { childPropName = childPropName.substring(0, childPropName.indexOf('[')); } if (childPropName.indexOf(".") > 0) { childPropName = childPropName.substring(0, childPropName.indexOf(".")); } // look for matching property boolean found = false; for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) { if (descriptor.getName().equals(childPropName)) { // found matching descriptor; recurse assertChildPropertiesExist(child, getPropertyType(descriptor)); found = true; break; } } if (!found) { fail("Did not find property " + childPropName + " in " + nodePropertyClass.getSimpleName() + ". Properties: " + listNames(beanInfo.getPropertyDescriptors())); } // check for "other" property, if applicable if (child instanceof CodedOrOtherPropertyNode) { boolean otherFound = false; CodedOrOtherPropertyNode codedOrOther = ((CodedOrOtherPropertyNode) child); for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) { otherFound = pd.getName().equals(codedOrOther.getOtherPropertyName()); if (otherFound) break; } if (!otherFound) { fail("Did not find property " + codedOrOther.getOtherPropertyName() + " ('other' for coded " + childPropName + ')' + " in " + nodePropertyClass.getSimpleName() + ". Properties: " + listNames(beanInfo.getPropertyDescriptors())); } } } } }
From source file:com.twinsoft.convertigo.engine.Context.java
public Object getTransactionProperty(String propertyName) { if (requestedObject == null) { return null; }/*from w w w .j a va 2 s.c om*/ BeanInfo bi; try { bi = CachedIntrospector.getBeanInfo(requestedObject.getClass()); } catch (IntrospectionException e) { Engine.logContext .error("getTransactionProperty : Exception while finding the bean info for transaction class '" + requestedObject.getClass() + "'", e); return null; } PropertyDescriptor[] propertyDescriptors = bi.getPropertyDescriptors(); int len2 = propertyDescriptors.length; PropertyDescriptor propertyDescriptor = null; Object propertyValue; int j; String propertyDescriptorName = ""; for (j = 0; j < len2; j++) { propertyDescriptor = propertyDescriptors[j]; propertyDescriptorName = propertyDescriptor.getName(); if (propertyDescriptorName.equals(propertyName)) break; } if (j == len2 && !propertyDescriptorName.equals(propertyName)) { Engine.logContext.debug("getTransactionProperty : no property descriptor found for the property '" + propertyName + "'"); return null; } Method getter = propertyDescriptor.getReadMethod(); Object args[] = {}; try { propertyValue = getter.invoke(requestedObject, args); } catch (Exception e) { Engine.logContext.error("getTransactionProperty : Exception while executing the property getter '" + getter.getName() + "'", e); return null; } return propertyValue; }
From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java
public Element toXml(Document document) throws EngineException { Element element = document.createElement(getDatabaseType().toLowerCase()); element.setAttribute("classname", getClass().getName()); if (exportOptions.contains(ExportOption.bIncludeVersion)) { element.setAttribute("version", com.twinsoft.convertigo.beans.Version.version); }//from w w w .jav a 2s. co m // Storing the database object priority element.setAttribute("priority", new Long(priority).toString()); int len; PropertyDescriptor[] propertyDescriptors; PropertyDescriptor propertyDescriptor; Element propertyElement; try { BeanInfo bi = CachedIntrospector.getBeanInfo(getClass()); propertyDescriptors = bi.getPropertyDescriptors(); len = propertyDescriptors.length; if (exportOptions.contains(ExportOption.bIncludeDisplayName)) { element.setAttribute("displayName", bi.getBeanDescriptor().getDisplayName()); } } catch (IntrospectionException e) { throw new EngineException("Couldn't introspect the bean \"" + getName() + "\"", e); } for (int i = 0; i < len; i++) { propertyDescriptor = propertyDescriptors[i]; String name = propertyDescriptor.getName(); String displayName = propertyDescriptor.getDisplayName(); String shortDescription = propertyDescriptor.getShortDescription(); Method getter = propertyDescriptor.getReadMethod(); // Only analyze read propertyDescriptors. if (getter == null) { continue; } if (checkBlackListParentClass(propertyDescriptor)) { continue; } try { // Storing the database object bean properties Object uncompiledValue = getCompilablePropertySourceValue(name); Object compiledValue = null; Object cypheredValue = null; Object value = getter.invoke(this); if (uncompiledValue != null) { compiledValue = value; value = uncompiledValue; } // Only write non-null values if (value == null) { Engine.logBeans.warn("Attempting to store null property (\"" + name + "\"); skipping..."); continue; } propertyElement = document.createElement("property"); propertyElement.setAttribute("name", name); // Encrypts value if needed //if (isCipheredProperty(name) && !this.exportOptions.contains(ExportOption.bIncludeDisplayName)) { if (isCipheredProperty(name) && (this.exportOptions.contains(ExportOption.bHidePassword) || !this.exportOptions.contains(ExportOption.bIncludeDisplayName))) { cypheredValue = encryptPropertyValue(value); if (!value.equals(cypheredValue)) { value = cypheredValue; propertyElement.setAttribute("ciphered", "true"); } } // Stores the value Node node = null; if (exportOptions.contains(ExportOption.bIncludeCompiledValue)) { node = XMLUtils.writeObjectToXml(document, value, compiledValue); } else { node = XMLUtils.writeObjectToXml(document, value); } propertyElement.appendChild(node); // Add visibility for logs if (!isTraceableProperty(name)) { propertyElement.setAttribute("traceable", "false"); } if (exportOptions.contains(ExportOption.bIncludeBlackListedElements)) { Object propertyDescriptorBlackListValue = propertyDescriptor .getValue(MySimpleBeanInfo.BLACK_LIST_NAME); if (propertyDescriptorBlackListValue != null && (Boolean) propertyDescriptorBlackListValue) { propertyElement.setAttribute("blackListed", "blackListed"); } } if (exportOptions.contains(ExportOption.bIncludeDisplayName)) { propertyElement.setAttribute("displayName", displayName); propertyElement.setAttribute("isHidden", Boolean.toString(propertyDescriptor.isHidden())); propertyElement.setAttribute("isMasked", isMaskedProperty(Visibility.Platform, name) ? "true" : "false"); propertyElement.setAttribute("isExpert", Boolean.toString(propertyDescriptor.isExpert())); } if (exportOptions.contains(ExportOption.bIncludeShortDescription)) { propertyElement.setAttribute("shortDescription", shortDescription); } if (exportOptions.contains(ExportOption.bIncludeEditorClass)) { Class<?> pec = propertyDescriptor.getPropertyEditorClass(); String message = ""; if (pec != null) { message = propertyDescriptor.getPropertyEditorClass().toString().replaceFirst("(.)*\\.", ""); } else { message = "null"; } if (this instanceof ITagsProperty || (pec != null && Enum.class.isAssignableFrom(pec))) { String[] sResults = null; try { if (this instanceof ITagsProperty) { sResults = ((ITagsProperty) this).getTagsForProperty(name); } else { sResults = EnumUtils.toNames(pec); } } catch (Exception ex) { sResults = new String[0]; } if (sResults != null) { if (sResults.length > 0) { Element possibleValues = document.createElement("possibleValues"); Element possibleValue = null; for (int j = 0; j < sResults.length; j++) { possibleValue = document.createElement("value"); possibleValue.setTextContent(sResults[j]); possibleValues.appendChild(possibleValue); } propertyElement.appendChild(possibleValues); } } } propertyElement.setAttribute("editorClass", message); } element.appendChild(propertyElement); if (Boolean.TRUE.equals(propertyDescriptor.getValue("nillable"))) { try { Method method = this.getClass().getMethod("isNullProperty", new Class[] { String.class }); Object isNull = method.invoke(this, new Object[] { name }); propertyElement.setAttribute("isNull", isNull.toString()); } catch (Exception ex) { Engine.logBeans.error( "[Serialization] Skipping 'isNull' attribute for property \"" + name + "\".", ex); } } } catch (Exception e) { Engine.logBeans.error("[Serialization] Skipping property \"" + name + "\".", e); } } return element; }
From source file:org.quartz.impl.StdSchedulerFactory.java
private void setBeanProps(Object obj, Properties props) throws NoSuchMethodException, IllegalAccessException, java.lang.reflect.InvocationTargetException, IntrospectionException, SchedulerConfigException { props.remove("class"); BeanInfo bi = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] propDescs = bi.getPropertyDescriptors(); PropertiesParser pp = new PropertiesParser(props); java.util.Enumeration keys = props.keys(); while (keys.hasMoreElements()) { String name = (String) keys.nextElement(); String c = name.substring(0, 1).toUpperCase(Locale.US); String methName = "set" + c + name.substring(1); java.lang.reflect.Method setMeth = getSetMethod(methName, propDescs); try {//from w ww . j a va 2 s .c om if (setMeth == null) { throw new NoSuchMethodException("No setter for property '" + name + "'"); } Class[] params = setMeth.getParameterTypes(); if (params.length != 1) { throw new NoSuchMethodException("No 1-argument setter for property '" + name + "'"); } if (params[0].equals(int.class)) { setMeth.invoke(obj, new Object[] { new Integer(pp.getIntProperty(name)) }); } else if (params[0].equals(long.class)) { setMeth.invoke(obj, new Object[] { new Long(pp.getLongProperty(name)) }); } else if (params[0].equals(float.class)) { setMeth.invoke(obj, new Object[] { new Float(pp.getFloatProperty(name)) }); } else if (params[0].equals(double.class)) { setMeth.invoke(obj, new Object[] { new Double(pp.getDoubleProperty(name)) }); } else if (params[0].equals(boolean.class)) { setMeth.invoke(obj, new Object[] { new Boolean(pp.getBooleanProperty(name)) }); } else if (params[0].equals(String.class)) { setMeth.invoke(obj, new Object[] { pp.getStringProperty(name) }); } else { throw new NoSuchMethodException("No primitive-type setter for property '" + name + "'"); } } catch (NumberFormatException nfe) { throw new SchedulerConfigException( "Could not parse property '" + name + "' into correct data type: " + nfe.toString()); } } }
From source file:de.hasait.clap.impl.CLAPClassNode.java
public CLAPClassNode(final CLAP pCLAP, final Class<T> pClass) { super(pCLAP); _class = pClass; _propertyDescriptorByOptionMap = new HashMap<CLAPValue<?>, PropertyDescriptor>(); _keywordNodes = new HashSet<CLAPKeywordNode>(); BeanInfo beanInfo; try {/*from ww w . j a v a 2 s. c o m*/ beanInfo = Introspector.getBeanInfo(pClass); } catch (final IntrospectionException e) { throw new RuntimeException(e); } final List<Item> annotations = new ArrayList<Item>(); final CLAPKeywords classKeywords = findAnnotation(pClass, CLAPKeywords.class); if (classKeywords != null) { for (final CLAPKeyword classKeyword : classKeywords.value()) { annotations.add(new Item(classKeyword.order(), classKeyword, null, null, null)); } } final CLAPHelpCategory classHelpCategory = findAnnotation(pClass, CLAPHelpCategory.class); if (classHelpCategory != null) { setHelpCategory(classHelpCategory.order(), classHelpCategory.titleNLSKey()); } final CLAPUsageCategory classUsageCategory = findAnnotation(pClass, CLAPUsageCategory.class); if (classUsageCategory != null) { setUsageCategory(classUsageCategory.order(), classUsageCategory.titleNLSKey()); } for (final PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) { final CLAPOption pdOption = getAnnotation(propertyDescriptor, CLAPOption.class); final CLAPDelegate pdDelegate = getAnnotation(propertyDescriptor, CLAPDelegate.class); final CLAPDecision pdDecision = getAnnotation(propertyDescriptor, CLAPDecision.class); final CLAPHelpCategory pdHelpCategory = getAnnotation(propertyDescriptor, CLAPHelpCategory.class); final CLAPUsageCategory pdUsageCategory = getAnnotation(propertyDescriptor, CLAPUsageCategory.class); if ((pdOption != null ? 1 : 0) + (pdDelegate != null ? 1 : 0) + (pdDecision != null ? 1 : 0) > 1) { throw new IllegalArgumentException(); } if (pdOption != null) { annotations.add( new Item(pdOption.order(), pdOption, propertyDescriptor, pdHelpCategory, pdUsageCategory)); } if (pdDelegate != null) { annotations.add(new Item(pdDelegate.order(), pdDelegate, propertyDescriptor, pdHelpCategory, pdUsageCategory)); } if (pdDecision != null) { annotations.add(new Item(pdDecision.order(), pdDecision, propertyDescriptor, pdHelpCategory, pdUsageCategory)); } } Collections.sort(annotations, new Comparator<Item>() { @Override public int compare(final Item pO1, final Item pO2) { return Integer.valueOf(pO1._order).compareTo(Integer.valueOf(pO2._order)); } }); for (final Item entry : annotations) { final Object annotation = entry._annotation; final AbstractCLAPNode node; if (annotation instanceof CLAPKeyword) { node = processCLAPKeyword((CLAPKeyword) annotation); } else if (annotation instanceof CLAPOption) { node = processCLAPOption(entry._propertyDescriptor.getPropertyType(), entry._propertyDescriptor, (CLAPOption) annotation); } else if (annotation instanceof CLAPDelegate) { node = processCLAPDelegate(entry._propertyDescriptor.getPropertyType(), entry._propertyDescriptor, (CLAPDelegate) annotation); } else if (annotation instanceof CLAPDecision) { node = processCLAPDecision(entry._propertyDescriptor.getPropertyType(), entry._propertyDescriptor, (CLAPDecision) annotation); } else { throw new RuntimeException(); } if (entry._helpCategory != null) { node.setHelpCategory(entry._helpCategory.order(), entry._helpCategory.titleNLSKey()); } if (entry._usageCategory != null) { node.setUsageCategory(entry._usageCategory.order(), entry._usageCategory.titleNLSKey()); } } }
From source file:com.github.javalbert.reflection.ClassAccessFactory.java
private void initializePropertyDescriptors() { @SuppressWarnings("unchecked") List<PropertyDescriptor> propertyDescriptors = Collections.EMPTY_LIST; try {//from w w w . ja va2 s.co m BeanInfo info = Introspector.getBeanInfo(clazz); propertyDescriptors = Collections.unmodifiableList(Arrays.stream(info.getPropertyDescriptors()) .filter(prop -> !prop.getName().equals("class")).collect(toList())); } catch (IntrospectionException e) { throw new RuntimeException(e); } for (int i = 0; i < propertyDescriptors.size(); i++) { addPropertyInfo(new PropertyInfo(propertyDescriptors.get(i), i)); } }
From source file:org.mypsycho.beans.PropertyUtilsBean.java
/** * <p>/*from w w w. ja v a2 s.co m*/ * Retrieve the property descriptors for the specified class, introspecting * and caching them the first time a particular bean class is encountered. * </p> * * @param beanClass Bean class for which property descriptors are requested * @return the property descriptors * @exception IllegalArgumentException if <code>beanClass</code> is null */ public PropertyDescriptor[] createDescriptorsCache(Class<?> beanClass) throws IntrospectionException { // Introspect the bean and cache the generated descriptors BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors(); if (descriptors == null) { return new PropertyDescriptor[0]; } // ----------------- Workaround for Bug 28358 --------- START ------------------ // // The following code fixes an issue where IndexedPropertyDescriptor // behaves // Differently in different versions of the JDK for 'indexed' properties // which use java.util.List (rather than an array). // // If you have a Bean with the following getters/setters for an indexed // property: // // public List getFoo() // public Object getFoo(int index) // public void setFoo(List foo) // public void setFoo(int index, Object foo) // // then the IndexedPropertyDescriptor's getReadMethod() and // getWriteMethod() // behave as follows: // // JDK 1.3.1_04: returns valid Method objects from these methods. // JDK 1.4.2_05: returns null from these methods. // for (PropertyDescriptor descriptor2 : descriptors) { if (!(descriptor2 instanceof IndexedPropertyDescriptor)) { continue; } IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor) descriptor2; String propName = descriptor.getName().substring(0, 1).toUpperCase() + descriptor.getName().substring(1); if (descriptor.getReadMethod() == null) { String methodName = (descriptor.getIndexedReadMethod() != null) ? descriptor.getIndexedReadMethod().getName() : "get" + propName; Method readMethod = MethodUtils.getMatchingAccessibleMethod(beanClass, methodName, EMPTY_CLASS_PARAMETERS); if (readMethod != null) { try { descriptor.setReadMethod(readMethod); } catch (Exception e) { notify("copy", "Fail to set indexed property" + propName, e); } } } if (descriptor.getWriteMethod() == null) { Method indexedMethod = descriptor.getIndexedWriteMethod(); String methodName = indexedMethod != null ? indexedMethod.getName() : "set" + propName; Method writeMethod = MethodUtils.getMatchingAccessibleMethod(beanClass, methodName, LIST_CLASS_PARAMETER); if (writeMethod == null) { Method[] methods = beanClass.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName)) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 1 && List.class.isAssignableFrom(parameterTypes[0])) { writeMethod = method; break; } } } } if (writeMethod != null) { try { descriptor.setWriteMethod(writeMethod); } catch (Exception e) { notify("copy", "Fail to set indexed property" + propName, e); } } } } // ----------------- Workaround for Bug 28358 ---------- END ------------------- return descriptors; }
From source file:org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.java
/** * Generate schema construct for given type * * @param javaType : Class to whcih need to generate Schema * @return : Generated QName/*from ww w. ja v a 2 s . c o m*/ */ protected QName generateSchema(Class<?> javaType) throws Exception { String name = getClassName(javaType); QName schemaTypeName = typeTable.getComplexSchemaType(name); if (schemaTypeName == null) { String simpleName = getSimpleClassName(javaType); String packageName = getQualifiedName(javaType.getPackage()); String targetNameSpace = resolveSchemaNamespace(packageName); XmlSchema xmlSchema = getXmlSchema(targetNameSpace); String targetNamespacePrefix = targetNamespacePrefixMap.get(targetNameSpace); if (targetNamespacePrefix == null) { targetNamespacePrefix = generatePrefix(); targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix); } XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaComplexContentExtension complexExtension = new XmlSchemaComplexContentExtension(); XmlSchemaElement eltOuter = new XmlSchemaElement(); schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); eltOuter.setName(simpleName); eltOuter.setQName(schemaTypeName); Class<?> sup = javaType.getSuperclass(); if ((sup != null) && (!"java.lang.Object".equals(sup.getName())) && (!"java.lang.Exception".equals(sup.getName())) && !getQualifiedName(sup.getPackage()).startsWith("org.apache.axis2") && !getQualifiedName(sup.getPackage()).startsWith("java.util")) { String superClassName = sup.getName(); String superclassname = getSimpleClassName(sup); String tgtNamespace; String tgtNamespacepfx; QName qName = typeTable.getSimpleSchemaTypeName(superClassName); if (qName != null) { tgtNamespace = qName.getNamespaceURI(); tgtNamespacepfx = qName.getPrefix(); } else { tgtNamespace = resolveSchemaNamespace(getQualifiedName(sup.getPackage())); tgtNamespacepfx = targetNamespacePrefixMap.get(tgtNamespace); QName superClassQname = generateSchema(sup); if (superClassQname != null) { tgtNamespacepfx = superClassQname.getPrefix(); tgtNamespace = superClassQname.getNamespaceURI(); } } if (tgtNamespacepfx == null) { tgtNamespacepfx = generatePrefix(); targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx); } //if the parent class package name is differ from the child if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().contains(tgtNamespace)) { XmlSchemaImport importElement = new XmlSchemaImport(); importElement.setNamespace(tgtNamespace); xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(), tgtNamespace); } QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx); complexExtension.setBaseTypeName(basetype); complexExtension.setParticle(sequence); XmlSchemaComplexContent contentModel = new XmlSchemaComplexContent(); contentModel.setContent(complexExtension); complexType.setContentModel(contentModel); } else { complexType.setParticle(sequence); } complexType.setName(simpleName); if (Modifier.isAbstract(javaType.getModifiers())) { complexType.setAbstract(true); } // xmlSchema.getItems().add(eltOuter); xmlSchema.getElements().add(schemaTypeName, eltOuter); eltOuter.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().add(schemaTypeName, complexType); // adding this type to the table typeTable.addComplexSchema(name, eltOuter.getQName()); // adding this type's package to the table, to support inheritance. typeTable.addComplexSchema(getQualifiedName(javaType.getPackage()), eltOuter.getQName()); typeTable.addClassNameForQName(eltOuter.getQName(), name); BeanExcludeInfo beanExcludeInfo = null; if (service.getExcludeInfo() != null) { beanExcludeInfo = service.getExcludeInfo().getBeanExcludeInfoForClass(getClassName(javaType)); } // we need to get properties only for this bean. hence ignore the super // class properties BeanInfo beanInfo = Introspector.getBeanInfo(javaType, javaType.getSuperclass()); for (PropertyDescriptor property : beanInfo.getPropertyDescriptors()) { String propertyName = property.getName(); if (!property.getName().equals("class") && (property.getPropertyType() != null)) { if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcludedProperty(propertyName)) { Type genericFieldType = null; try { Field field = javaType.getDeclaredField(propertyName); genericFieldType = field.getGenericType(); } catch (Exception e) { //log.info(e.getMessage()); } if (genericFieldType instanceof ParameterizedType) { ParameterizedType aType = (ParameterizedType) genericFieldType; Type[] fieldArgTypes = aType.getActualTypeArguments(); try { generateSchemaforGenericFields(xmlSchema, sequence, fieldArgTypes[0], propertyName); } catch (Exception e) { generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getPropertyType(), propertyName, property.getPropertyType().isArray()); } } else { generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getPropertyType(), propertyName, property.getPropertyType().isArray()); } } } } } return schemaTypeName; }
From source file:org.enerj.apache.commons.beanutils.PropertyUtilsBean.java
/** * <p>Retrieve the property descriptors for the specified class, * introspecting and caching them the first time a particular bean class * is encountered.</p>//from ww w .j av a2s . c om * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param beanClass Bean class for which property descriptors are requested * * @exception IllegalArgumentException if <code>beanClass</code> is null */ public PropertyDescriptor[] getPropertyDescriptors(Class beanClass) { if (beanClass == null) { throw new IllegalArgumentException("No bean class specified"); } // Look up any cached descriptors for this bean class PropertyDescriptor descriptors[] = null; descriptors = (PropertyDescriptor[]) descriptorsCache.get(beanClass); if (descriptors != null) { return (descriptors); } // Introspect the bean and cache the generated descriptors BeanInfo beanInfo = null; try { beanInfo = Introspector.getBeanInfo(beanClass); } catch (IntrospectionException e) { return (new PropertyDescriptor[0]); } descriptors = beanInfo.getPropertyDescriptors(); if (descriptors == null) { descriptors = new PropertyDescriptor[0]; } descriptorsCache.put(beanClass, descriptors); return (descriptors); }