如果我尝试使用日期类型条件的简单 Drools 规则并使用条件 OR ( ||
),则会收到以下错误。如果我改变||
它&&
工作正常。这是错误、已知限制还是我的规则有问题?我正在使用 Drools 5.5.0 Final
规则文件
package net.madhura.drools.rules
import net.madhura.drools.DateContainer;
dialect "mvel"
rule "Test rule"
when
$container: DateContainer(
date >= "15-Oct-2013" || date <= "01-Oct-2013"
)
then
System.out.println("working");
end
日期容器类
package net.madhura.drools;
import java.util.Date;
public class DateContainer {
private Date date;
public DateContainer(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
错误
Unable to Analyse Expression date >= "15-Oct-2013" || date <= "01-Oct-2013":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... date >= "15-Oct-2013" || date <= "01-Oct-2013" ....}]
^
[Line: 9, Column: 1] : [Rule name='Test rule']