从指定Class中获取指定Field，并尝试将其accessible属性设置为true（并不能获取到父类声明的字段）
@param clazz Class
@param fieldName fieldName
@return Field，不会为null，只会抛出异常
762696
public static Field getField(Class<?> clazz, String fieldName) {
        Assert.notNull(clazz, "clazz不能为空");
        Assert.notNull(fieldName, "fieldName不能为空");
        return FIELD_CACHE.compute(new FieldKey(fieldName, clazz), (k, v) -> {
            if (v == null) {
                try {
                    return allowAccess(clazz.getDeclaredField(fieldName));
                } catch (NoSuchFieldException e) {
                    log.error(StringUtils.format("类[{0}]中不存在字段[{1}]", clazz, fieldName));
                    throw new ReflectException(
                        StringUtils.format("类[{0}]中不存在字段[{1}]", clazz, fieldName), e);
                }
            } else {
                return v;
            }
        });
    }
1364896
public static ClassLoader getClassLoader(Class clazz){
        ClassLoader classLoader = clazz.getClassLoader();
        return classLoader==null ? ClassLoader.getSystemClassLoader() : classLoader;
    }
664787
public static <T> T getField(Object obj, String string, Class<?> clazz, Class<T> fieldType) {
		try {
			final Field field = clazz.getDeclaredField(string);
			field.setAccessible(true);
			final Object value = field.get(obj);
			return fieldType.cast(value);
		} catch (Exception exception) {
			throw new Error(exception);
		}
	}
898729
public static Field getField(String fieldName, Class<?> clazz) {
    Field field = null;
    try {
      field = clazz.getDeclaredField(fieldName);
    }
    catch (SecurityException e) {
      throw LOG.unableToAccessField(field, clazz.getName());
    }
    catch (NoSuchFieldException e) {
      // for some reason getDeclaredFields doesnt search superclasses
      // (which getFields() does ... but that gives only public fields)
      Class<?> superClass = clazz.getSuperclass();
      if (superClass != null) {
        return getField(fieldName, superClass);
      }
    }
    return field;
  }
486476
public static Field getField(String fieldName, Class<?> clazz) {
    Field field = null;
    try {
      field = clazz.getDeclaredField(fieldName);
    } catch (SecurityException e) {
      throw new ActivitiException("not allowed to access field " + field + " on class " + clazz.getCanonicalName());
    } catch (NoSuchFieldException e) {
      // for some reason getDeclaredFields doesn't search superclasses
      // (which getFields() does ... but that gives only public fields)
      Class<?> superClass = clazz.getSuperclass();
      if (superClass != null) {
        return getField(fieldName, superClass);
      }
    }
    return field;
  }
1321888
public Field[] getFields(Class clazz, String fieldname) {
	Struct fieldMap;
	Object o;
	synchronized (map) {
	    o = map.get(clazz);
	    if (o == null) {
		fieldMap = store(clazz);
	    }
	    else fieldMap = (Struct) o;
	}
	o = fieldMap.get(fieldname, null);
	if (o == null) return null;
	return (Field[]) o;

    }
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;
    }
156223
public static Field[] jlClassGetFields(Class<?> clazz) {
		ReloadableType rtype = getRType(clazz);
		if (rtype == null) {
			return clazz.getFields();
		}
		else {
			List<Field> allFields = new ArrayList<Field>();
			gatherFields(clazz, allFields, new HashSet<Class<?>>());
			return allFields.toArray(new Field[allFields.size()]);
		}
	}
223103
public static Method getClassFieldReadMethod(Class<?> clazz, String fieldName) {
		return getClassReadMethods(clazz).get(fieldName);
	}
268828
public <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		if( clazzz == null )
			return null;

		for( Clazz<?> c : clazzz.values() )
			if( c.getReflectedClass() == clazz )
			{
				@SuppressWarnings( "unchecked" )
				Clazz<T> result = (Clazz<T>) c;
				return result;
			}

		return null;
	}
74406
public static Field forName(Class cl, String name) {
        java.lang.reflect.Field result;

        try {
            result = cl.getDeclaredField(name);
        } catch (NoSuchFieldException e) {
            return null;
        }

        return create(result);
    }
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()]);
    }
730117
public static List<Object> getFieldValues(Class<? extends Enum<?>> clazz, String fieldName) {
		final Enum<?>[] enums = clazz.getEnumConstants();
		if (null == enums) {
			return null;
		}
		final List<Object> list = new ArrayList<>(enums.length);
		for (Enum<?> e : enums) {
			list.add(ReflectUtil.getFieldValue(e, fieldName));
		}
		return list;
	}
1144193
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) {
    String setterName = "set" + Character.toTitleCase(fieldName.charAt(0)) + fieldName.substring(1, fieldName.length());
    try {
      // Using getMethods(), getMethod(...) expects exact parameter type
      // matching and ignores inheritance-tree.
      Method[] methods = clazz.getMethods();
      for (Method method : methods) {
        if (method.getName().equals(setterName)) {
          Class<?>[] paramTypes = method.getParameterTypes();
          if (paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) {
            return method;
          }
        }
      }
      return null;
    } catch (SecurityException e) {
      throw new ActivitiException("Not allowed to access method " + setterName + " on class " + clazz.getCanonicalName());
    }
  }
1343748
public <T> Optional<T> getFieldOptional(String fieldName, Class<T> clazz) {
        return DPathUtils.getValueOptional(fieldData, fieldName, clazz);
    }
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;
    }
139569
public static Field[] getFieldsIgnoreCase(Class clazz, String name) throws NoSuchFieldException {
	Field[] fields = fStorage.getFields(clazz, name);
	if (fields != null) return fields;
	throw new NoSuchFieldException("there is no field with name " + name + " in object [" + Type.getName(clazz) + "]");
    }