Get only the first Level of Nested Reference Attributes from a given class
@param clazz
@return List<Field> of referenced fields
546886
public static List<Field> getFirstLevelOfReferenceAttributes(Class<?> clazz) {
        List<Field> references = new ArrayList<Field>();
        List<String> referencedFields = ReflectionUtils.getReferencedAttributeNames(clazz);

        for(String eachReference : referencedFields) {
            Field referenceField = ReflectionUtils.getField(clazz, eachReference);
            references.add(referenceField);
        }

        return references;
    }
1366422
public static Stack<Class<?>> getClassHierarchy(final Class<?> clazz) {
        final Stack<Class<?>> classHierarchy = new Stack<Class<?>>();
        Class<?> c = clazz;
        while (c != null) {
            classHierarchy.push(c);
            c = (isStatic(c.getModifiers())) ? null : c.getEnclosingClass();
        }
        return classHierarchy;
    }
720554
public static Predicate<Field> inClass(Class<?> clazz) {
        return field -> field.getDeclaringClass().equals(clazz);
    }
647656
public static <T> Set<Class<? extends T>> getNonAbstractSubclasses(Class<T> clazz) {
        return ClassGraphUtil/*TraverseClasspath*/.getNonAbstractSubClasses(clazz);
    }
570379
public static List<Field> getSelfAndSuperClassFields(Class<?> clazz) {//YongZ added this method
		List<Field> fields = new ArrayList<Field>();
		for (Field field : clazz.getDeclaredFields())
			fields.add(field);

		Class<?> superclass = clazz.getSuperclass();
		while (superclass != null) {
			if (Object.class.equals(superclass)) {
				break;
			}
			for (Field field : superclass.getDeclaredFields())
				fields.add(field);
			superclass = superclass.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()]);
    }
728694
public List<String> getMappedPersistenceUnit(Class<?> clazz)
    {
        return this.clazzToPuMap != null ? this.clazzToPuMap.get(clazz.getName()) : null;
    }
772068
public static Field[] getAllDeclaredFields(Class<?> clazz) {
		Field[] declaredFields = clazz.getDeclaredFields();
		Class<?> superClass = clazz.getSuperclass();
		if (superClass != null && superClass != Object.class) {
			declaredFields = ArrayUtil.concat(declaredFields, getAllDeclaredFields(superClass));
		}
		return declaredFields;
	}
382213
public static Field getField(final Class<?> clazz, final String fieldName) {
        //Define return type
        //
        Field
            field = null;

        //For each class in the hierarchy starting with the current class, try to find the declared field
        //
        for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) {
            try {
                //Attempt to get the field, if exception is thrown continue to the next class
                //
                field =
                    current
                        .getDeclaredField(
                            fieldName
                        );
            }
            catch (final NoSuchFieldException e) {
                //ignore and continue searching
                //
            }
        }

        //Return the field we found
        //
        return
            field;
    }
1072982
public static List<ElementConfig> getElements(Class clazz) {
      if (!cacheEC.containsKey(clazz)) {
         cacheEC.put(clazz, new ArrayList<>(1));
         Element e = (Element) clazz.getAnnotation(Element.class);
         if (e != null) {
            cacheEC.get(clazz).add(fromAnnotation(e));
         }
         Elements es = (Elements) clazz.getAnnotation(com.vectorprint.report.itext.annotations.Elements.class);
         if (es != null) {
            for (Element s : es.elements()) {
               cacheEC.get(clazz).add(fromAnnotation(s));
            }
         }
      }
      return cacheEC.get(clazz);
   }
975656
private static List<Class<?>> getClassHierarchy(Class<?> clazz) {
		List<Class<?>> hierarchy = new ArrayList<Class<?>>( 4 );

		for ( Class<?> current = clazz; current != null; current = current.getSuperclass() ) {
			hierarchy.add( current );
		}

		return hierarchy;
	}
493855
public static List<Field> getNotKeyColumns(Class<?> clazz) {
		List<Field> fields = getColumns(clazz);
		
		List<Field> keyFields = new ArrayList<Field>();
		for(Field field : fields) {
			Column column = field.getAnnotation(Column.class);
			if(!column.isKey()) {
				keyFields.add(field);
			}
		}
		return keyFields;
	}
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;
    }
317475
public static Field[] getAnnotationFields(Class<?> clazz, Class<? extends Annotation> annotationClass) {
        if (clazz == null || annotationClass == null) {
            return null;
        }

        List<Field> fields = getAllFieldsOfClass0(clazz);
        if (CollectionUtil.isEmpty(fields)) {
            return null;
        }

        List<Field> list = CollectionUtil.createArrayList();
        for (Field field : fields) {
            if (null != field.getAnnotation(annotationClass)) {
                list.add(field);
                field.setAccessible(true);
            }
        }

        return list.toArray(new Field[0]);
    }
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;
	}
62198
public static List<Field> getAllFields(Class clazz) {
        List<Field> all = new ArrayList<Field>();
        for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) {
            Field[] fields = c.getDeclaredFields(); // 所有方法，不包含父类
            for (Field field : fields) {
                int mod = field.getModifiers();
                // 过滤static 和 transient，支持final
                if (Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
                    continue;
                }
                field.setAccessible(true); // 不管private还是protect都可以
                all.add(field);
            }
        }
        return all;
    }
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;
    }