Constructor and Description |
---|
RuleBookRunner(RuleBook ruleBook,
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.
|
void |
defineRules()
Define the Rules in the RuleBook as Rule annotated POJO Rules in the specified package.
|
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.
|
public RuleBookRunner(java.lang.String rulePackage)
rulePackage
- a package to scan for POJO Rulespublic RuleBookRunner(RuleBook ruleBook, java.lang.String rulePackage)
ruleBook
- the RuleBook 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
public void defineRules()
defineRules
in interface RuleBook