Hello, I noticed that I am using the PropertyAccessiorFactory.forBeanPropertyAccess
method,Use it this way
BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(MyClass.class);
beanWrapper.setPropertyValue("age", 18);
I found an error and found that BeanWrapperImpl (Class<?>class)
was supposed to be called, but BeanWrapperImpl (Object object)
was called. I think we should add an assertion Assert. state (! (target instance of Class), "The target object must be an instance."
in forBeanPropertyAccess, or be compatible with both object and class situations in this area.
Thanks.
Comment From: snicoll
The Javadoc of the method you've referenced states:
Obtain a BeanWrapper for the given target object, accessing properties in JavaBeans style.
As such, the code sample above is misusing the API and should be fixed, rather than us attempting to guess what you're trying to do.
Comment From: osenx
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。