Package org.rossonet.ext.rules.api
Interface Rule
-
- All Superinterfaces:
java.lang.Comparable<Rule>
- All Known Implementing Classes:
ActivationRuleGroup,BasicRule,CompositeRule,ConditionalRuleGroup,JexlRule,MVELRule,UnitRuleGroup
public interface Rule extends java.lang.Comparable<Rule>
Abstraction for a rule that can be fired by a rules engine. Rules are registered in a namespace of rule of typeRulesin which they must have a unique name.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DESCRIPTIONDefault rule description.static java.lang.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 java.lang.StringgetDescription()Getter for rule description.default java.lang.StringgetName()Getter for rule name.default intgetPriority()Getter for rule priority.default booleanisTraceEnable()
-
-
-
Field Detail
-
DEFAULT_NAME
static final java.lang.String DEFAULT_NAME
Default rule name.- See Also:
- Constant Field Values
-
DEFAULT_DESCRIPTION
static final java.lang.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
-
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
-
execute
void execute(Facts facts) throws java.lang.Exception
This method implements the rule's action(s).- Throws:
java.lang.Exception- thrown if an exception occurs when performing action(s)
-
getDescription
default java.lang.String getDescription()
Getter for rule description.- Returns:
- rule description
-
getName
default java.lang.String getName()
Getter for rule name.- Returns:
- the rule name
-
getPriority
default int getPriority()
Getter for rule priority.- Returns:
- rule priority
-
isTraceEnable
default boolean isTraceEnable()
-
-