Return a list of all {@link Field} in the class {@code clazz} and its base classes.
@param clazz class to interrogate for {@link Field}
@return list of all {@link Field} in the class {@code clazz} and its base classes
16583
public static List<Field> getAllFields(Class<?> clazz) {
        final List<Field> ret = new ArrayList<>();
        do {
            ret.addAll(Arrays.asList(clazz.getDeclaredFields()));
            clazz = clazz.getSuperclass();
        } while (clazz != null);
        return ret;
    }
184125
public static List<Field> findFields(final Class<?> clazz) {
        List<Field> foundFields = new ArrayList<>();
        Class<?> searchType = clazz;
        while (!Object.class.equals(searchType) && (searchType != null)) {
            Field[] fields = searchType.getDeclaredFields();
            for (Field field : fields) {
                field.setAccessible(true);
                foundFields.add(field);
            }
            searchType = searchType.getSuperclass();
        }
        return foundFields;
    }
579039
public static List<Method> getAllMethods(List<Method> methods, Class<?> clazz)
  {
    for (Method method : clazz.getDeclaredMethods())
    {
      methods.add(method);
    }

    if (clazz.getSuperclass() != null)
    {
      methods = getAllMethods(methods, clazz.getSuperclass());
    }

    return methods;
  }
1108226
@SuppressWarnings("unchecked")
    public <T> List<T> getList(Class<T> clazz) {
        return (List<T>) objects;
    }
900493
public static Field[] findFields(Class<?> clazz) throws IllegalAccessException {
        final List<Field> fieldList = new ArrayList<Field>();

        doWithDeclaredFields(clazz, new FieldCallback() {
            public void doWith(Field field) {
                fieldList.add(field);
            }
        });
        return fieldList.toArray(new Field[fieldList.size()]);
    }
668889
public static List<Class<?>> getAllClasses(Class<?> clazz) {
        List<Class<?>> types = new ArrayList<>();
        while (clazz != null) {
            types.add(clazz);
            clazz = clazz.getSuperclass();
        }
        return types;
    }
144805
public static Set<Field> getDeclaredFields(Class<?> clazz, FieldFilter filter) {
        Set<Field> fields = new HashSet<Field>();
        Field[] allFields = clazz.getDeclaredFields();
        for(Field field : allFields) {
            if(filter.passFilter(field)) {
                fields.add(field);
            }
        }
        return fields;
    }
1288429
public static Field findField(Class<?> clazz, String name) {
        Class<?> entityClass = clazz;
        while (!Object.class.equals(entityClass) && entityClass != null) {
            Field[] fields = entityClass.getDeclaredFields();
            for (Field field : fields) {
                if (name.equals(field.getName())) {
                    return field;
                }
            }
            entityClass = entityClass.getSuperclass();
        }
        return null;
    }
114699
public static List<String> getFieldNames(Class<? extends Enum<?>> clazz) {
		final List<String> names = new ArrayList<>();
		final Field[] fields = ReflectUtil.getFields(clazz);
		String name;
		for (Field field : fields) {
			name = field.getName();
			if (field.getType().isEnum() || name.contains("$VALUES") || "ordinal".equals(name)) {
				continue;
			}
			if(false == names.contains(name)) {
				names.add(name);
			}
		}
		return names;
	}
1262284
public static Field[] getAllFields(final Class<?> clazz) {
        final List<Field> allFields = new ArrayList<>();
        addFields(allFields, clazz);
        return allFields.toArray(new Field[allFields.size()]);
    }
679914
List<Field> getFields(Class<?> clazz) {
        List<Field> result = new ArrayList<>();
        Set<String> fieldNames = new HashSet<>();
        Class<?> searchType = clazz;
        while (!Object.class.equals(searchType) && searchType != null) {
            Field[] fields = searchType.getDeclaredFields();
            for (Field field : fields) {
                if (!fieldNames.contains(field.getName())) {
                    fieldNames.add(field.getName());
                    makeAccessible(field);
                    result.add(field);
                }
            }
            searchType = searchType.getSuperclass();
        }
        return result;
    }
583325
static List<Field> getAllFieldsOfClass0(Class<?> clazz) {
        List<Field> fields = CollectionUtil.createArrayList();
        for (Class<?> itr = clazz; hasSuperClass(itr); ) {
            fields.addAll(Arrays.asList(itr.getDeclaredFields()));
            itr = itr.getSuperclass();
        }

        return fields;
    }
1173965
public static Method[] getDeclaredMethods(Class clazz) {
	Method[] methods = clazz.getMethods();
	ArrayList list = new ArrayList();
	for (int i = 0; i < methods.length; i++) {
	    if (methods[i].getDeclaringClass() == clazz) list.add(methods[i]);
	}
	if (list.size() == 0) return new Method[0];
	return (Method[]) list.toArray(new Method[list.size()]);
    }
1066507
public static <T extends Annotation> Set<Field> getAnnotatedFields(Class<? extends Object> clazz,
			Class<T> annotation) {
		if (Object.class.equals(clazz)) {
			return Collections.emptySet();
		}
		Set<Field> annotatedFields = new HashSet<Field>();
		Field[] fields = clazz.getDeclaredFields();
		for (Field field : fields) {
			if (field.getAnnotation(annotation) != null) {
				annotatedFields.add(field);
			}
		}
		annotatedFields.addAll(getAnnotatedFields(clazz.getSuperclass(), annotation));
		return annotatedFields;
	}
837739
public static Field getField(Class<?> clazz, String fieldName)
      throws NoSuchFieldException {
    if (clazz == Object.class) {
      return null;
    }
    try {
      Field field = clazz.getDeclaredField(fieldName);
      return field;
    } catch (NoSuchFieldException e) {
      return getField(clazz.getSuperclass(), fieldName);
    }
  }
843522
public static List<Field> getClassFields(Class<?> beanClass) {
		Map<String, Field> resultMap = new HashMap<>();
		LinkedList<Field> results = new LinkedList<>();

		Class<?> currentClass = beanClass;
		while (currentClass != null && currentClass != Object.class) {
			for (Field field : currentClass.getDeclaredFields()) {
				if (!field.isSynthetic()) {
					Field v = resultMap.get(field.getName());
					if (v == null) {
						resultMap.put(field.getName(), field);
						results.add(field);
					}
				}
			}
			currentClass = currentClass.getSuperclass();
		}

		return results;
	}
463377
private static List<Field> getAllFields(Class<?> clazz){
		if(!clazz.equals(Object.class)){
			List<Field> fields = new ArrayList<Field>(Arrays.asList(clazz.getDeclaredFields()));
			List<Field> fields2 = getAllFields(clazz.getSuperclass());
			if(fields2!=null){
				fields.addAll(fields2);
			}
			return fields;
		}else{
			return null;
		}
	}