Drools 无法在.drl文件中的对象中获取数据

Drools 无法在.drl文件中的对象中获取数据,drools,Drools,我的.drl文件中有两条规则 rule "Monitor" when s : Test1( type == Test1.X ) n : Test123() then n.monitor(); drools.setFocus("Rules"); end rule "Utilization" agenda-group "Rules" when s : Test1( type == Test1.X , newValue > o

我的.drl文件中有两条规则

rule "Monitor"  
when
    s : Test1( type == Test1.X )    
    n : Test123()
then
    n.monitor();        
    drools.setFocus("Rules");
end

rule "Utilization"
agenda-group "Rules"
when
    s : Test1( type == Test1.X , newValue > oldValue )
    n : Test123()
then
    //Do something
end

monitor()是类Test123中的一个方法,该方法使用getter和setter为类Test1中的一些变量设置值。这个方法返回一个对象“object”。在我的第二条规则中,我想比较对象“object”中的值(newValue>oldValue)。如何执行此操作

您可以将旧值保存在全局变量中,并在第二条规则中与之比较。

soooo。。。。。这里有些问题你没有解释。。。您是否可以添加“Test1”和“Test123”类,或者至少添加“newValue”和“oldValue”等相关部分,以便我们知道您在谈论什么,以及这些规则如何运行的实现片段?在我看来,你似乎有一些初始问题或什么