Package org.jeasy.rules.api
Interface Rule
- All Superinterfaces:
Comparable<Rule>
Abstraction for a rule that can be fired by a rules engine.
Rules are registered in a namespace of rule of type Rules
in which they must have a
unique name.
- Author:
- Mahmoud Ben Hassine ([email protected])
-
Field Summary
Fields -
Method Summary
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
DEFAULT_NAME
Default rule name.- See Also:
-
DEFAULT_DESCRIPTION
Default rule description.- See Also:
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYDefault rule priority.- See Also:
-
-
Method Details
-
getName
Getter for rule name.- Returns:
- the rule name
-
getDescription
Getter for rule description.- Returns:
- rule description
-
getPriority
default int getPriority()Getter for rule priority.- Returns:
- rule priority
-
evaluate
This method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly- Returns:
- true if the rule should be applied given the provided facts, false otherwise
-
execute
This method implements the rule's action(s).- Throws:
Exception
- thrown if an exception occurs when performing action(s)
-