code: private static Field[] getAllFieldsRec(Class clazz, List<Field> fields) {
          Class superClazz = clazz.getSuperclass();
          if (superClazz != null) {
              getAllFieldsRec(superClazz, fields);
          }
  
          fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
          return fields.toArray(new Field[fields.size()]);
      }
docs: Get all fields rec.
  
  @param clazz  the clazz
  @param fields the fields
  @return the field [ ]