code: public static Field[] getAllFields(Class<?> clz) {
      List<Field> list = new ArrayList<>();
      do {
        list.addAll(Arrays.asList(clz.getDeclaredFields()));
      } while ((clz = clz.getSuperclass()) != null);
      return list.toArray(new Field[list.size()]);
    }
docs: Get all fields
  
  @param clz
  @return