集册 Java实例教程 解析二传手

解析二传手

欢马劈雪     最近更新时间:2020-01-02 10:19:05

536
解析二传手
/**时 代 J a v a - N o w J a v a . c o m**/


//package com.nowjava;

import java.lang.reflect.Method;


public class Main {

    private static final String SET_PREFIX = "set";


    public static Method parseSetter(Object bean, String propertyName,

            Class<?> propertyClass) throws SecurityException,

            NoSuchMethodException {

        return bean.getClass().getMethod(

                getSetMethodName(propertyName, propertyClass));

    }//N o w J a v a . c o m 提 供


    public static String getSetMethodName(String propertyName,

            Class<?> propertyClass) {

        return SET_PREFIX + capitalizeMethodName(propertyName);

    }


    private static String capitalizeMethodName(String propertyName) {

        StringBuilder sb = 
展开阅读全文