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.
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