Retrieve the setter for the specified class/field if it exists.

@param clazz
@param f
@return
769569
public static Method getSetter(Class<?> clazz, Field f) {
        Method setter = null;
        for (Method m : clazz.getMethods()) {
            if (ReflectionUtils.isSetter(m) &&
                    m.getName().equals(SETTER_PREFIX + StringUtils.capitalize(f.getName()))) {
                setter = m;
                break;
            }
        }
        return setter;
    }
574838
@SuppressWarnings("unchecked")
    public <T> Set<T> getSet(Class<T> clazz) {
        return (Set<T>) objects;
    }
1051432
private static <T> Method tryGetSetMethod(Class<T> clazz, Field field, String methodName) {

        try {
            return clazz.getDeclaredMethod(methodName, field.getType());
        } catch (Exception e) {

            return null;
        }

    }
860192
public SerializerConfig setClass(final Class<? extends Serializer> clazz) {
        String className = clazz == null ? null : clazz.getName();
        return setClassName(className);
    }
622588
public static void getFields (Class<?> clazz, List<Field> addTo)
    {
        // first get the fields of the superclass
        Class<?> pclazz = clazz.getSuperclass();
        if (pclazz != null && !pclazz.equals(Object.class)) {
            getFields(pclazz, addTo);
        }

        // then reflect on this class's declared fields
        Field[] fields;
        try {
            fields = clazz.getDeclaredFields();
        } catch (SecurityException se) {
            System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se);
            fields = new Field[0];
        }

        // override the default accessibility check for the fields
        try {
            AccessibleObject.setAccessible(fields, true);
        } catch (SecurityException se) {
            // ah well, only publics for us
        }

        for (Field field : fields) {
            int mods = field.getModifiers();
            if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) {
                continue; // skip static and transient fields
            }
            addTo.add(field);
        }
    }
831677
public static void doWithLocalFields(Class<?> clazz, FieldCallback fc) {
		for (Field field : getDeclaredFields(clazz)) {
			try {
				fc.doWith(field);
			}
			catch (IllegalAccessException ex) {
				throw new IllegalStateException("Not allowed to access field '" + field.getName() + "': " + ex);
			}
		}
	}
1175856
public static Method getSetterMethod(Class<?> clazz, String propertyName, Class<?> parameterType) {
		String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(propertyName);
		return getMethod(clazz, setterMethodName, parameterType);
	}
772129
public static boolean hasSetter(Class<?> clazz) {
		if (ClassUtil.isNormalClass(clazz)) {
			final Method[] methods = clazz.getMethods();
			for (Method method : methods) {
				if (method.getParameterTypes().length == 1 && method.getName().startsWith("set")) {
					// 检测包含标准的setXXX方法即视为标准的JavaBean
					return true;
				}
			}
		}
		return false;
	}
822048
public static Method getAccessor(Class<?> clazz, String field) {
        LOG.trace( "getAccessor({}, {})", clazz, field );
        try {
            return clazz.getMethod( "get" + ucFirst( field ) );
        } catch ( NoSuchMethodException e ) {
            try {
                return clazz.getMethod( field );
            } catch ( NoSuchMethodException e1 ) {
                try {
                    return clazz.getMethod( "is" + ucFirst( field ) );
                } catch ( NoSuchMethodException e2 ) {
                    return null;
                }
            }
        }
    }
1017896
public static <T> Clazz<T> Clazz( Class<T> clazz )
	{
		return impl.Clazz( clazz );
	}
1364896
public static ClassLoader getClassLoader(Class clazz){
        ClassLoader classLoader = clazz.getClassLoader();
        return classLoader==null ? ClassLoader.getSystemClassLoader() : classLoader;
    }
33223
public <T extends AbstractSchemaProperty> T get(final Class<T> clazz, final String name) {
        Set<T> propertyCollection = get(clazz);
        for (T property : propertyCollection) {
            if (property.getName().equals(name)) {
                return property;
            }
        }
        return null;
    }
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;
  }
1235078
public Method getSetter( String name )
    {
        for (PropertyDescriptor descriptor : getPropertyDescriptors( target ))
        {
            Method setter = descriptor.getWriteMethod();
            if (setter == null) continue;
            if (compare( descriptor.getName(), name )) return setter;
        }
        return null;
    }
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]);
    }
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()]);
		}
	}
720554
public static Predicate<Field> inClass(Class<?> clazz) {
        return field -> field.getDeclaringClass().equals(clazz);
    }