Drools:drl 文件变量
Drools : drl file variables
下面是我的 class :
public class NumberDetails {
private String a ;
private String b;
private String c;
private String status;
private String result;
// getters and setters
}
初始化值
状态:302,a = "A",b="2"
我必须应用逻辑:
if(status=302){
result = a+b;
}
如何在.drl文件中写这个?
rule "302 case"
when
numberObject: NumberDetails(status==302)
then
numberObject.setResult(numberObject(a)+numberObject(b)); // I know this is wrong but how to write it ?
end
您可以使用 getter and setter
方法获取 drl file
中的值。例如,您可以将规则写为:
rule "302 case"
when
numberObject: NumberDetails(status==302)
then
numberObject.setResult(numberObject.getA()+numberObject.getB());
end
下面是我的 class :
public class NumberDetails {
private String a ;
private String b;
private String c;
private String status;
private String result;
// getters and setters
}
初始化值 状态:302,a = "A",b="2"
我必须应用逻辑:
if(status=302){
result = a+b;
}
如何在.drl文件中写这个?
rule "302 case"
when
numberObject: NumberDetails(status==302)
then
numberObject.setResult(numberObject(a)+numberObject(b)); // I know this is wrong but how to write it ?
end
您可以使用 getter and setter
方法获取 drl file
中的值。例如,您可以将规则写为:
rule "302 case"
when
numberObject: NumberDetails(status==302)
then
numberObject.setResult(numberObject.getA()+numberObject.getB());
end