code: public static List<Field> getAllFields(Class<?> type) {
          List<Field> fields = new ArrayList<>();
  
          for (Class<?> currentType = type; currentType != null; currentType = currentType.getSuperclass()) {
              fields.addAll(Arrays.asList(currentType.getDeclaredFields()));
          }
  
          return fields;
      }
docs: <p>getAllFields.</p>
  
  @param type a {@link java.lang.Class} object.
  @return a {@link java.util.List} object.