public abstract class AbstractRuleBookRunner extends Auditor implements RuleBook
Constructor and Description |
---|
AbstractRuleBookRunner(java.lang.Class<? extends RuleBook> prototypeClass)
Creates a new RuleBookRunner using the RuleBook class.
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(Rule rule)
Add a Rule.
|
protected abstract java.util.List<java.lang.Class<?>> |
getPojoRules()
Gets the POJO Rules used in the RuleBook.
|
java.util.Optional<Result> |
getResult()
Get the Result of the RuleBook.
|
protected java.lang.Object |
getRuleInstance(java.lang.Class<?> rule)
Returns a rule instance
|
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.
|
getRuleStatus, getRuleStatusMap, registerRule, updateRuleStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
defineRules
public AbstractRuleBookRunner(java.lang.Class<? extends RuleBook> prototypeClass)
prototypeClass
- a RuleBook class that determines how the RuleBook is runpublic 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 boolean hasRules()
RuleBook
protected java.lang.Object getRuleInstance(java.lang.Class<?> rule)
For container aware contexts (like Spring, Guice, Weld, etc.) override this method and instantiate the rule via the container.
rule
- The rule classprotected abstract java.util.List<java.lang.Class<?>> getPojoRules()