Package org.jeasy.rules.core
Class FastRule
java.lang.Object
org.jeasy.rules.core.FastRule
- All Implemented Interfaces:
Comparable<Rule>,Rule
Basic rule implementation class that provides common methods.
You can extend this class and override when(Facts) and then(Facts) to provide rule conditions and actions logic. This is very similar to
BasicRule
- Author:
- Mahmoud Ben Hassine ([email protected])
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringRule description.protected StringRule name.protected intRule priority.Fields inherited from interface org.jeasy.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanThis method implements the rule's condition(s).final voidThis method implements the rule's action(s).Getter for rule description.getName()Getter for rule name.intGetter for rule priority.protected abstract voidprotected abstract booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
name
Rule name. -
description
Rule description. -
priority
protected int priorityRule priority.
-
-
Constructor Details
-
FastRule
-
FastRule
-
-
Method Details
-
when
-
then
-
evaluate
Description copied from interface:RuleThis method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly -
execute
Description copied from interface:RuleThis method implements the rule's action(s). -
getName
Description copied from interface:RuleGetter for rule name. -
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
-