Package org.jeasy.rules.core
Class FastRule
- java.lang.Object
-
- org.jeasy.rules.core.FastRule
-
- All Implemented Interfaces:
Comparable<Rule>,Rule
public abstract class FastRule extends Object implements Rule
Basic rule implementation class that provides common methods.You can extend this class and override
when(Facts)andthen(Facts)to provide rule conditions and actions logic. This is very similar toBasicRule- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdescriptionRule description.protected StringnameRule name.protected intpriorityRule priority.-
Fields inherited from interface org.jeasy.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanevaluate(Facts facts)This method implements the rule's condition(s).voidexecute(Facts facts)This method implements the rule's action(s).StringgetDescription()Getter for rule description.StringgetName()Getter for rule name.intgetPriority()Getter for rule priority.protected abstract voidthen(Facts facts)protected abstract booleanwhen(Facts facts)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
when
protected abstract boolean when(Facts facts)
-
then
protected abstract void then(Facts facts)
-
evaluate
public final boolean evaluate(Facts facts)
Description copied from interface:RuleThis method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly
-
execute
public final void execute(Facts facts) throws Exception
Description copied from interface:RuleThis method implements the rule's action(s).
-
getDescription
public String getDescription()
Description copied from interface:RuleGetter for rule description.- Specified by:
getDescriptionin interfaceRule- Returns:
- rule description
-
getPriority
public int getPriority()
Description copied from interface:RuleGetter for rule priority.- Specified by:
getPriorityin interfaceRule- Returns:
- rule priority
-
-