code: Class<?> getGenericType(Type type) {
          if (type instanceof ParameterizedType) {
              ParameterizedType pt = (ParameterizedType) type;
              Type[] ts = pt.getActualTypeArguments();
              if (ts.length == 1) {
                  return (Class<?>) ts[0];
              }
          }
          Class<?> clazz = (Class<?>) type;
          if (clazz.isArray()) {
              return clazz.getComponentType();
          }
          return Object.class;
      }
docs: Get generic type of property, e.g. generic type of List<String> is String.
  Return Class<Object> if no generic type.