Constructor and Description |
---|
RuleAdapter(java.lang.Object rulePojo)
Deprecated.
|
RuleAdapter(java.lang.Object rulePojo,
Rule rule)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
FactMap |
getFactMap()
Deprecated.
The getFactMap() method gets the FactMap used for the current Rule.
|
java.lang.Object |
getResult()
Deprecated.
The
getResult() method returns the stored result from the Decision
The value may be null. |
java.util.List<java.lang.Object> |
getThen()
Deprecated.
Method getThen() gets the instance(s) of the functional interface(s) responsible for the action to be performed by
the Rule.
|
java.util.function.Predicate |
getWhen()
Deprecated.
Method getWhen() gets the
Predicate that evaluates the condition of the Rule. |
Decision |
given(Fact... facts)
Deprecated.
The given() method sets the Facts to be used by the Rule.
|
Decision |
given(FactMap facts)
Deprecated.
The given() method sets the Facts to be used by the Rule.
|
Decision |
given(java.util.List list)
Deprecated.
The given() method sets the Facts to be used by the Rule.
|
Decision |
given(java.lang.String name,
java.lang.Object value)
Deprecated.
The given() method sets the Facts to be used by the Rule.
|
Decision |
givenUnTyped(FactMap facts)
Deprecated.
The givenUnTyped method sets an untyped FactMap.
|
void |
run(java.lang.Object... otherArgs)
Deprecated.
This run() method allows for arguments in addition to the FactMap to be passed to the action(s).
|
void |
setNextRule(Rule rule)
Deprecated.
The setNextRule method adds the next Rule to the chain.
|
void |
setResult(Result result)
Deprecated.
The
setResult() method initializes the stored result; useful for aggregation/chaining of a result. |
Decision |
stop()
Deprecated.
Stops the rule chain after the then() method executes.
Note: this will only happen if the when() condition evaluates to true. |
Decision |
then(java.util.function.BiConsumer action)
Deprecated.
The then method specifies the action taken if
when() evaluates to true. |
Decision |
then(java.util.function.Consumer action)
Deprecated.
The then() method performs some action based on facts.
This then() method does not imply a return value, only that the next chained then() is executed. |
Decision |
using(java.lang.String... factName)
Deprecated.
The using() method reduces the Facts used by the then() method to only the value of the Fact specified
by the factName.
|
Decision |
when(java.util.function.Predicate test)
Deprecated.
The when() method takes in a
Predicate that evaluates the facts against a condition. |
public RuleAdapter(java.lang.Object rulePojo, Rule rule) throws java.io.InvalidClassException
rulePojo
- an annotated POJO to be adapted to a rulerule
- the Rule
object delegated to for the adaptationjava.io.InvalidClassException
- if the POJO does not have the @Rule annotationpublic RuleAdapter(java.lang.Object rulePojo) throws java.io.InvalidClassException
Rule
annotated POJO
and adapts it to a Rule
or Decision
.
This convenience constructor supplies a generic StandardRule
to RuleAdapter(Object, Rule).rulePojo
- an annotated POJO to be adapted to a rulejava.io.InvalidClassException
- if the POJO does not have the @Rule annotationpublic Decision given(Fact... facts)
Rule
public Decision given(java.util.List list)
Rule
public Decision given(FactMap facts)
Rule
public Decision given(java.lang.String name, java.lang.Object value)
Rule
public Decision givenUnTyped(FactMap facts)
Rule
givenUnTyped
in interface Decision
givenUnTyped
in interface Rule
facts
- a FactMap
public java.util.function.Predicate getWhen()
Rule
Predicate
that evaluates the condition of the Rule.public java.util.List<java.lang.Object> getThen()
Rule
public void run(java.lang.Object... otherArgs)
Rule
public Decision when(java.util.function.Predicate test)
Rule
Predicate
that evaluates the facts against a condition.public Decision then(java.util.function.Consumer action)
Rule
public Decision then(java.util.function.BiConsumer action)
Decision
when()
evaluates to true.
The execution of this 'then' takes precedence over then(Function)
if both exist.public Decision using(java.lang.String... factName)
Rule
public Decision stop()
Rule
public java.lang.Object getResult()
Decision
getResult()
method returns the stored result from the Decision
The value may be null.public void setResult(Result result)
Decision
setResult()
method initializes the stored result; useful for aggregation/chaining of a result.public FactMap getFactMap()
Rule
getFactMap
in interface Rule
public void setNextRule(Rule rule)
Rule
setNextRule
in interface Rule
rule
- the next Rule to add to the chain