toMethod.invoke(to, new Object[] { value });
}
}
/**
* 從方法數組中獲取指定名稱的方法
*
* @param methods
* @param name
* @return
*/
public static Method findMethodByName(Method[] methods, String name) {
for (int j = 0; j < methods.length; j++) {
if (methods[j].getName().equals(name)) {
return methods[j];
}
}
return null;
}
public static void main(String[] args) {
PBlackList from = new PBlackList();
from.setPunTime(new Date());
from.setAppPerName("方貴");
from.setEffect(1);
from.setAppPerNum("10102322");
PBlackList targ = new PBlackList();
String[] excut = new String[30];
excut[0] = "apppernum";
try {
copyPropertiesExclude(from, targ, excut);
System.out.println("日期:"+targ.getPunTime()+"-申請人:"+targ.getAppPerName()+"-有效:"+targ.getEffect()+"-編號:"+targ.getAppPerNum());
} catch (Exception e) {
e.printStackTrace();
}
}
}