Пример #1
0
  /** Get a list of the bean properties */
  public static Map getProperties(Class javaType, TypeDesc typeDesc) {
    Map propertyMap = null;

    if (typeDesc != null) {
      propertyMap = typeDesc.getPropertyDescriptorMap();
    } else {
      BeanPropertyDescriptor[] pd = BeanUtils.getPd(javaType, null);
      propertyMap = new StructImpl(); // use this to get rid of case sensitivity

      // loop through properties and grab the names for later
      for (int i = 0; i < pd.length; i++) {
        BeanPropertyDescriptor descriptor = pd[i];
        propertyMap.put(descriptor.getName(), descriptor);
      }
    }

    return propertyMap;
  }