We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
笔误:
public class RebateInfo { private String userId; // 用户ID private String bizId; // 业务ID private Date bizTime; // 业务时间 private String desc; // 业务描述 // ... get/set }
public static RebateInfo filter(Map obj, Map<String, String> link) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { RebateInfo rebateInfo = new RebateInfo(); for (String key : link.keySet()) { Object val = obj.get(link.get(key)); RebateInfo.class.getMethod("set" + key.substring(0, 1).toUpperCase() + key.substring(1), String.class).invoke(rebateInfo, val.toString()); } return rebateInfo; }
RebateInfo 类中的bizTime为Date类型,没法通在反射的时候指定参数类型为String调用此方法,会出现java.lang.NoSuchMethodException: 异常,应该是需要把bizTime定义为String类型吧,,亦或是如果需要做到适配其它类型的话,怎么做比较好一点呢?例如Integer/Double等等
RebateInfo
bizTime
Date
String
java.lang.NoSuchMethodException:
Integer
Double
The text was updated successfully, but these errors were encountered:
No branches or pull requests
笔误:
RebateInfo
类中的bizTime
为Date
类型,没法通在反射的时候指定参数类型为String
调用此方法,会出现java.lang.NoSuchMethodException:
异常,应该是需要把bizTime定义为String类型吧,,亦或是如果需要做到适配其它类型的话,怎么做比较好一点呢?例如Integer
/Double
等等The text was updated successfully, but these errors were encountered: