当我使用drools规则引擎时,如何表达一个对象为null

Sno*_*Qin 4 drools business-rules

我想知道当我使用drools规则引擎时,如何在左侧表示一个对象为null?任何人都可以告诉我如何使用drools关键字"不"等等.谢谢!

anu*_*ava 6

您可以调用notin when子句来检查null对象:

rule "somerule"
    no-loop
    when not AnObject()
    then
      // rule body when AnObject is null
end;
Run Code Online (Sandbox Code Playgroud)