code: public static Map<String, Object> toMap(Object inputParameter, PropertyDescriptor[] propertyDescriptors) {
          Map<String, Object> resultMap = new HashMap<String, Object>();
          Object propertyValue = null;
  
          for (PropertyDescriptor property : propertyDescriptors) {
              propertyValue = callGetter(inputParameter, property);
  
              if ("class".equals(property.getName()) == false) {
                  resultMap.put(property.getName(), propertyValue);
              }
          }
  
          return resultMap;
      }
docs: Converts Java Object into Map<String, Object>.
  Keys and Values are read from PropertyDescriptors
  
  @param inputParameter      Object which would be converted into Map
  @param propertyDescriptors Array of Class PropertyDescriptors
  @return Map<String, Object> with values from Object