public static Method prefixMethodOfBeanByField(String prefix, Class<?> clazz, Field field,
                                                   Class<?>... argTypes) {
        Method method = null;
        String fieldName = field.getName();
        StringBuilder builder = new StringBuilder(prefix);
        builder.append(fieldName.substring(0, 1).toUpperCase());
        builder.append(fieldName.substring(1, fieldName.length()));
        String methodName = builder.toString();
        try {
            method = clazz.getDeclaredMethod(methodName, argTypes);
        } catch (SecurityException e) {
        } catch (NoSuchMethodException e) {
        }
        return method;
    }
public static Method prefixMethodOfBeanByField(String prefix, Class<?> clazz, Field field,
                                                   Class<?>... argTypes) {
        Method method = null;
        String fieldName = field.getName();
        StringBuilder builder = new StringBuilder(prefix);
        builder.append(fieldName.substring(0, 1).toUpperCase());
        builder.append(fieldName.substring(1, fieldName.length()));
        String methodName = builder.toString();
        try {
            method = clazz.getDeclaredMethod(methodName, argTypes);
        } catch (SecurityException e) {
        } catch (NoSuchMethodException e) {
        }
        return method;
    }
public static Method prefixMethodOfBeanByField ( String prefix , Class < ? > clazz , Field field , Class < ? > ... argTypes ) { Method method = null ; String fieldName = field . getName ( ) ; StringBuilder builder = new StringBuilder ( prefix ) ; builder . append ( fieldName . substring ( 0 , 1 ) . toUpperCase ( ) ) ; builder . append ( fieldName . substring ( 1 , fieldName . length ( ) ) ) ; String methodName = builder . toString ( ) ; try { method = clazz . getDeclaredMethod ( methodName , argTypes ) ; } catch ( SecurityException e ) { } catch ( NoSuchMethodException e ) { } return method ; }
根据字段获取Class类的set方法 <br>
2013-10-21 下午12:05:53

@param clazz
@param field
@return
根据字段获取Class类的set方法 <br > 2013 - 10 - 21 下午12 : 05 : 53