Package org.jeasy.rules.core
Class FastRule
- java.lang.Object
-
- org.jeasy.rules.core.FastRule
-
- All Implemented Interfaces:
Comparable<Rule>
,Rule
public abstract class FastRule extends Object implements Rule
Basic rule implementation class that provides common methods.You can extend this class and override
when(Facts)
andthen(Facts)
to provide rule conditions and actions logic. This is very similar toBasicRule
- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description protected String
description
Rule description.protected String
name
Rule name.protected int
priority
Rule priority.-
Fields inherited from interface org.jeasy.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete 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).String
getDescription()
Getter for rule description.String
getName()
Getter for rule name.int
getPriority()
Getter for rule priority.protected abstract void
then(Facts facts)
protected abstract boolean
when(Facts facts)
-
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
-
-
-
-
Method Detail
-
when
protected abstract boolean when(Facts facts)
-
then
protected abstract void then(Facts facts)
-
evaluate
public final boolean evaluate(Facts facts)
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
public final void execute(Facts facts) throws Exception
Description copied from interface:Rule
This method implements the rule's action(s).
-
getDescription
public String 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
-
-