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 String
Rule description.protected String
Rule name.protected int
Rule priority.Fields inherited from interface org.jeasy.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
This method implements the rule's condition(s).final void
This method implements the rule's action(s).Getter for rule description.getName()
Getter for rule name.int
Getter for rule priority.protected abstract void
protected abstract boolean
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
-
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:Rule
This method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly -
execute
Description copied from interface:Rule
This method implements the rule's action(s). -
getName
Description copied from interface:Rule
Getter for rule name. -
getDescription
Description copied from interface:Rule
Getter for rule description.- Specified by:
getDescription
in interfaceRule
- Returns:
- rule description
-
getPriority
public int getPriority()Description copied from interface:Rule
Getter for rule priority.- Specified by:
getPriority
in interfaceRule
- Returns:
- rule priority
-