public String resultValue(String objValueTemp, TmpContractInfo tmpContractInfo) throws NoSuchMethodException,
SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<TmpContractInfo> clazz = TmpContractInfo.class;
Method method = clazz.getDeclaredMethod(objValueTemp);
Object objValue = method.invoke(tmpContractInfo);
String value = null;
if (objValue != null && objValue instanceof String) {
value = (String) objValue;
}
return value;
}
第一次使用Java反射,拿属性值
猜你喜欢
转载自blog.csdn.net/goodlook0123/article/details/81064744
今日推荐
周排行