| Constructor and Description |
|---|
RuleAdapter(java.lang.Object pojoRule)
Adapts a POJO to a the default Rule type (i.e.
|
RuleAdapter(java.lang.Object pojoRule,
Rule rule)
Adapts a POJO to a Rule given a POJO and a Rule.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAction(java.util.function.BiConsumer action)
Adds an action to the Rule to be invoked if the condition evaluates to true.
|
void |
addAction(java.util.function.Consumer action)
Adds an action to the Rule to be invoked if the condition evaluates to true.
|
void |
addFactNameFilter(java.lang.String... factNames)
Adds a filter to the facts by name.
|
void |
addFacts(NameValueReferable... facts)
Adds facts to a Rule.
|
void |
addFacts(NameValueReferableMap facts)
Adds facts to a Rule.
|
java.util.List<java.lang.Object> |
getActions()
Gets an ordered list of the actions added to the Rule.
|
java.util.function.Predicate<NameValueReferableMap> |
getCondition()
Gets the condition specified for the Rule.
|
NameValueReferableMap |
getFacts()
Gets the facts maintained in the Rule.
|
java.util.Optional<Result> |
getResult()
Gets the Result of the Rule
|
RuleState |
getRuleState()
Gets the RuleState of the Rule.
|
boolean |
invoke()
Invokes the Rule.
|
void |
setCondition(java.util.function.Predicate condition)
Sets the condition for the Rule
|
void |
setFacts(NameValueReferableMap facts)
Sets the facts for a Rule.
|
void |
setResult(Result result)
Sets the Result of the Rule.
|
void |
setRuleState(RuleState ruleState)
Sets the
RuleState for the Rule; determines whether the rule chain should continue or not. |
public RuleAdapter(java.lang.Object pojoRule,
Rule rule)
throws java.io.InvalidClassException
pojoRule - the @Rule annotated POJOrule - a Rule objectjava.io.InvalidClassException - if the @Rule annotation is missing from the POJOpublic RuleAdapter(java.lang.Object pojoRule)
throws java.io.InvalidClassException
GoldenRule).pojoRule - the @Rule annotated POJOjava.io.InvalidClassException - if the @Rule annotation is missing from the POJOpublic void addFacts(NameValueReferable... facts)
Rulepublic void addFacts(NameValueReferableMap facts)
Rulepublic void setFacts(NameValueReferableMap facts)
Rulepublic void setCondition(java.util.function.Predicate condition)
throws java.lang.IllegalStateException
RulesetCondition in interface Rulecondition - the true or false condition implementation for the Rule.java.lang.IllegalStateExceptionpublic void setRuleState(RuleState ruleState)
RuleRuleState for the Rule; determines whether the rule chain should continue or not.setRuleState in interface RuleruleState - the new RuleState to be setpublic void addAction(java.util.function.Consumer action)
Rulepublic void addAction(java.util.function.BiConsumer action)
Rulepublic void addFactNameFilter(java.lang.String... factNames)
RuleaddFactNameFilter in interface RulefactNames - the names of the facts filtered (i.e. to be included)public NameValueReferableMap getFacts()
Rulepublic java.util.function.Predicate<NameValueReferableMap> getCondition()
RulegetCondition in interface Rulepublic RuleState getRuleState()
RulegetRuleState in interface Rulepublic java.util.List<java.lang.Object> getActions()
RulegetActions in interface Rulepublic boolean invoke()
Rulepublic void setResult(Result result)
Rule