to check if an Object is present in List in Drools

浪尽此生 提交于 2019-12-21 21:12:12

问题


I am newbie in Drools and given the work to write rule files i.e. drl files. I am facing one issue.

The operator contains is used to check whether a field that is a Collection or array contains the specified value.

Object( objList contains "bye" ) -- to verify if "bye' is there in objList or not i.e. for verifying String.

But, I have List of Objects and want to check if List contains any particular Object or not so I used the above replacing String with an object but that didn't work.'

Can someone please help me.


回答1:


Try memberOf operator
From Drools Rule Language Documentation

The operator memberOf is used to check whether a field is a member of a collection or array; that collection must be a variable. Blockquote



来源:https://stackoverflow.com/questions/17051361/to-check-if-an-object-is-present-in-list-in-drools

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