我按照张老师的方法:
ReflectPoint pt1 = new ReflectPoint(3,6);
String propertyName = "x";
PropertyDescriptor pd = new PropertyDescriptor(propertyName,pt1.getClass());
Method methodGetX = pd.getReadMethod();
Object retval = methodGetX.invoke(pt1);
将后三句代码重构然后抽取出方法:但提示Ambiguous return value:Selected block contains more than one assignment
to local variables are:
PropertyDescriptor pd
Object retval
是不是版本不一样?
怎么理解javaBean?
javaBean和反射有何关系? |
|