Constructor and Description |
---|
RuleBookRunner(java.lang.Class<? extends RuleBook> ruleBookClass,
java.lang.String rulePackage)
Creates a new RuleBookRunner using the specified package and the supplied RuleBook.
|
RuleBookRunner(java.lang.String rulePackage)
Creates a new RuleBookRunner using the specified package and the default RuleBook.
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(Rule rule)
Add a Rule.
|
java.util.Optional<Result> |
getResult()
Get the Result of the RuleBook.
|
boolean |
hasRules()
The hasRules() method returns true if any Rules have been defined in the RuleBook.
|
void |
run(NameValueReferableMap facts)
Run the RuleBook given the facts supplied.
|
void |
setDefaultResult(java.lang.Object result)
Set the default Result value; this should be set for RuleBooks that are expected to produce a Result.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
defineRules
public RuleBookRunner(java.lang.String rulePackage)
rulePackage
- a package to scan for POJO Rulespublic RuleBookRunner(java.lang.Class<? extends RuleBook> ruleBookClass, java.lang.String rulePackage)
ruleBookClass
- the RuleBook type to use as a delegate for the RuleBookRunnerrulePackage
- the package to scan for POJO rulespublic void run(NameValueReferableMap facts)
RuleBook
public void setDefaultResult(java.lang.Object result)
RuleBook
setDefaultResult
in interface RuleBook
result
- the default Result valuepublic java.util.Optional<Result> getResult()
RuleBook