Skip to content
New issue

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

pageVo对象注入使用get/set #7

Open
wysnxzm opened this issue Jan 18, 2018 · 1 comment
Open

pageVo对象注入使用get/set #7

wysnxzm opened this issue Jan 18, 2018 · 1 comment

Comments

@wysnxzm
Copy link

wysnxzm commented Jan 18, 2018

直接用反射还是不太好吧!

@xuxueli
Copy link
Owner

xuxueli commented Oct 15, 2018

你好,对比过 “反射” 与 “调用set方法” 两种赋值方法,前者耗时进位后者 6%,性能差异太大,所以暂时保持反射方式。

  • “反射” 方式:
field.setAccessible(true);
field.set(pageVo, fieldValue);
  • “调用set方法” 方式:
PropertyDescriptor pd = new PropertyDescriptor(field.getName(), pageVoClassType);
Method method = pd.getWriteMethod();
method.invoke(pageVo, fieldValue);

@wysnxzm wysnxzm changed the title pageVo对象注入使用get/set----徐志摩 pageVo对象注入使用get/set Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants