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

BeanUtil.setProperty 希望表达式可以支持list直接设置值 #3580

Closed
NieWeiChao opened this issue May 11, 2024 · 4 comments
Closed
Labels

Comments

@NieWeiChao
Copy link

NieWeiChao commented May 11, 2024

版本情况

JDK版本: Oraclejdk1.8.0_401-b10
hutool版本: 5.8.X10(请确保最新尝试是否还有问题)

问题描述(包括截图)

请求实现新特性
BeanUtil.setProperty 希望可以支持list直接设置值,用下图这种方式,设置值会报空指针异常
image

  1. 复现代码
  • 对象中有list集合,然后list集合中的对象还有list集合,希望可以通过表达式一步到位,设置某个具体的字段值
  1. 堆栈信息
    image

  2. 测试涉及到的文件(注意脱密)

比如报错的Excel文件,有问题的图片等。

@looly
Copy link
Member

looly commented May 11, 2024

可以考虑使用BeanPath。

@looly looly added the question label May 11, 2024
@NieWeiChao
Copy link
Author

可以考虑使用BeanPath。

大佬,beanpath如何使用能支持我这个场景,尝试了一下没实现效果

@NieWeiChao
Copy link
Author

reopened

@looly
Copy link
Member

looly commented May 13, 2024

@NieWeiChao

BeanPath.create([1].name).set(list, value);

@looly looly closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants