spring SPeL combine filter and projection operations

旧巷老猫 提交于 2019-12-11 18:07:43

问题


Colleagues, how to combine together projection operator ![expr]and filter ?[ boolean ]. For example I have some entity:

class User {
    int age;
    String name;
}

I would like select from list of Users only name of user who is elder than 30.

Standalone projection looks like:

#myArray.![name]

Standalone filtering looks like:

#myArray.?[age > 30]

So how to put it together? Thank you in advance!


回答1:


(#myArray.?[age > 30]).![name]

i.e. perform the projection on the results of the selection.



来源:https://stackoverflow.com/questions/11687484/spring-spel-combine-filter-and-projection-operations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!