在drools中的"then"子句中获取规则名称

Man*_*ani 12 drools

是否可以在流氓规则的then子句中检索规则名称?

rule "A"
    when
        ---
    then
        // something that outputs "A"
Run Code Online (Sandbox Code Playgroud)

谢谢.

Cyr*_*hor 30

是的,在then子句中你可以使用表达式:

drools.getRule().getName()
Run Code Online (Sandbox Code Playgroud)