Package org.jeasy.rules.api
Interface Rule
-
- All Superinterfaces:
Comparable<Rule>
public interface Rule extends Comparable<Rule>
Abstraction for a rule that can be fired by a rules engine.Rules are registered in a namespace of rule of type
Rulesin which they must have a unique name.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DESCRIPTIONDefault rule description.static StringDEFAULT_NAMEDefault rule name.static intDEFAULT_PRIORITYDefault rule priority.
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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).default StringgetDescription()Getter for rule description.default StringgetName()Getter for rule name.default intgetPriority()Getter for rule priority.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
DEFAULT_NAME
static final String DEFAULT_NAME
Default rule name.- See Also:
- Constant Field Values
-
DEFAULT_DESCRIPTION
static final String DEFAULT_DESCRIPTION
Default rule description.- See Also:
- Constant Field Values
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITY
Default rule priority.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
default String getName()
Getter for rule name.- Returns:
- the rule name
-
getDescription
default String getDescription()
Getter for rule description.- Returns:
- rule description
-
getPriority
default int getPriority()
Getter for rule priority.- Returns:
- rule priority
-
evaluate
boolean evaluate(Facts facts)
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
-
-