how to express one object is null when I use drools rule engine

SnowQin picture SnowQin · Jan 22, 2014 · Viewed 10.3k times · Source

I want to know how can I express one object is null on the left hand side when I use drools rule engine? And anybody can tell me how to use the drools keyword "not" and so on.Thank you!

Answer

anubhava picture anubhava · Jan 22, 2014

You can call not in when clause to check for null objects:

rule "somerule"
    no-loop
    when not AnObject()
    then
      // rule body when AnObject is null
end;