code: private TypePair getPropertyType(Object bean, String name) throws IllegalAccessException, InvocationTargetException {
          try {
              PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(bean, name);
              if(propDescriptor!=null) {
                  Method m = propDescriptor.getWriteMethod();
                  if(m!=null)
                      return new TypePair(m.getGenericParameterTypes()[0], m.getParameterTypes()[0]);
              }
          } catch (NoSuchMethodException e) {
              // no such property
          }
  
          // try a field
          try {
              return new TypePair(bean.getClass().getField(name));
          } catch (NoSuchFieldException e) {
              // no such field
          }
  
          return null;
      }
docs: Gets the type of the field/property designate by the given name.