T - the Result typepublic interface RuleBook<T>
| Modifier and Type | Method and Description |
|---|---|
void |
addRule(Rule rule)
Add a Rule.
|
default void |
defineRules()
The defineRules method can be optionally implemented to define rules in a either a completely
custom RuleBook or in a RuleBook that extends (subclasses) an existing RuleBook implementation.
|
java.util.Optional<Result<T>> |
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(T result)
Set the default Result value; this should be set for RuleBooks that are expected to produce a Result.
|
void addRule(Rule rule)
rule - the Rule to add to the RuleBookvoid run(NameValueReferableMap facts)
facts - the facts to be applied to the execution of the RuleBookvoid setDefaultResult(T result)
result - the default Result valuejava.util.Optional<Result<T>> getResult()
default void defineRules()
boolean hasRules()