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
Rules
in which they must have a unique name.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_DESCRIPTION
Default rule description.static String
DEFAULT_NAME
Default rule name.static int
DEFAULT_PRIORITY
Default rule priority.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
evaluate(Facts facts)
This method implements the rule's condition(s).void
execute(Facts facts)
This method implements the rule's action(s).default String
getDescription()
Getter for rule description.default String
getName()
Getter for rule name.default int
getPriority()
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
-
-