是否有任何方法通过在java中直接和完全实现规则条件来使用drools,就像在
https://github.com/j-easy/easy-rules (请参阅“声明方式”和“编程方式”一节)
就像这样:
@Rule(name = "weather rule", description = "if it rains then take an umbrella" )
public class WeatherRule {
@Condition
public boolean itRains(@Fact("rain") boolean rain) {
return rain;
}
@Action
public void takeAnUmbrella() {
System.out.println("It rains, take an umbrella!");
}
}或者也许
Rule weatherRule = new RuleBuilder()
.name("weather rule")
.description("if it rains then take an umbrella")
.when(facts -> facts.get("rain").equals(true))
.then(facts -> System.out.println("It rains, take an umbrella!"))
.build();发布于 2019-01-11 11:38:47
https://stackoverflow.com/questions/54032296
复制相似问题