diff --git a/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRule.java b/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRule.java index 68c29ee..34eae0f 100644 --- a/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRule.java +++ b/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRule.java @@ -26,6 +26,7 @@ package org.jeasy.rules.mvel; import org.jeasy.rules.api.Action; import org.jeasy.rules.api.Condition; import org.jeasy.rules.api.Facts; +import org.jeasy.rules.api.Rule; import org.jeasy.rules.core.BasicRule; import java.util.ArrayList; @@ -42,37 +43,43 @@ public class MVELRule extends BasicRule { private List actions = new ArrayList<>(); /** - * Create a new MVEL action. + * Create a new MVEL rule. */ public MVELRule() { + super(Rule.DEFAULT_NAME, Rule.DEFAULT_DESCRIPTION, Rule.DEFAULT_PRIORITY); } /** - * Create a new MVEL action. + * Set rule name. * * @param name of the rule + * @return this rule */ - public MVELRule(String name) { - super(name); + public MVELRule name(String name) { + this.name = name; + return this; } /** - * Create a new MVEL action. - * @param name of the rule + * Set rule description. + * * @param description of the rule + * @return this rule */ - public MVELRule(String name, String description) { - super(name, description); + public MVELRule description(String description) { + this.description = description; + return this; } /** - * Create a new MVEL action. - * @param name of the rule - * @param description of the rule + * Set rule priority. + * * @param priority of the rule + * @return this rule */ - public MVELRule(String name, String description, int priority) { - super(name, description, priority); + public MVELRule priority(int priority) { + this.priority = priority; + return this; } /** diff --git a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELRuleTest.java b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELRuleTest.java index d3dc835..604bf3f 100644 --- a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELRuleTest.java +++ b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELRuleTest.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MVELRuleTest { private Facts facts = new Facts(); - private MVELRule mvelRule = new MVELRule("rn", "rd", 1); + private MVELRule mvelRule = new MVELRule().name("rn").description("rd").priority(1); @Before public void setUp() throws Exception {