0
我有一個包含一個Collection或一組值的數組。 我想寫這種形式的規則:如何編寫Drools規則來驗證數組或列表中的多個值
rule "listRule"
when
$first: from list1() and $first!= "a" and $first!="b"
$second: from list1() and $second!="c" and $second != "z"
then
System.out.println(" this works!")
end
的目標是能夠評估如果列表或陣列具有2個或更多個對象($第一,$第二等等),每個滿足他們的不同狀況。它可以是一個數組或列表。
爲我工作。感謝你的回答。我可以有一個還是在那裏?從$ list 或$ s2:String(this!= $ s1,toString!=「c」&&!=「z」)從$ s1:String(toString!=「a」&&!=「b」)from $ list列表 –
是的。用括號圍繞兩個模式。 ---但它沒有意義,因爲可以以更簡單的方式實現相同的效果。 – laune