j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.87k stars 1.05k forks source link

how to evaluate a value in the collection #310

Closed rahamathulla-ai closed 3 years ago

rahamathulla-ai commented 4 years ago

I have an object which has collection and the collection elements may have multiple collection elements and this may go iteratively. how do i use jeasy rules to get the value of nested objects in hierarchy.

for instance. I have class A.

it has list of Bs. the B may have list of Cs

i want to iterate over All Bs and for each B, i want to check it has C with field D with value ='Sample'. how do i achieve this.

fmbenhassine commented 3 years ago

This is not specific to Easy Rules, it depends on the expression language you use . So please check the reference documentation of the expression language you use. I personally don't recommend using an EL if the condition/action start to become complex, a rule coded in Java is more appropriate in such cases.