|
|
|
@ -45,12 +45,13 @@ public class Launcher {
|
|
|
|
|
// create rules
|
|
|
|
|
MVELRule ageRule = new MVELRule()
|
|
|
|
|
.name("age rule")
|
|
|
|
|
.description("Check if person's age is > 18 and marks the person as adult")
|
|
|
|
|
.description("Check if person's age is > 18 and mark the person as adult")
|
|
|
|
|
.priority(1)
|
|
|
|
|
.when("person.age > 18")
|
|
|
|
|
.then("person.setAdult(true);");
|
|
|
|
|
MVELRuleFactory ruleFactory = new MVELRuleFactory(new YamlRuleDefinitionReader());
|
|
|
|
|
Rule alcoholRule = ruleFactory.createRule(new FileReader("src/main/java/org/jeasy/rules/tutorials/shop/alcohol-rule.yml"));
|
|
|
|
|
String fileName = args.length != 0 ? args[0] : "easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/alcohol-rule.yml";
|
|
|
|
|
Rule alcoholRule = ruleFactory.createRule(new FileReader(fileName));
|
|
|
|
|
|
|
|
|
|
// create a rule set
|
|
|
|
|
Rules rules = new Rules();
|
|
|
|
|