T
- the type of facts used in the RuleU
- the Result type used in the Rulepublic class RuleBuilder<T,U> extends java.lang.Object implements TerminatingRuleBuilder<T,U>
Modifier and Type | Method and Description |
---|---|
Rule<T,U> |
build()
Builds the Rule.
|
static RuleBuilder<java.lang.Object,java.lang.Object> |
create()
Returns a new RuleBuilder for the default Rule type.
|
static RuleBuilder<java.lang.Object,java.lang.Object> |
create(java.lang.Class<? extends Rule> ruleClass)
Returns a new RuleBuilder for the specified Rule class.
|
GivenRuleBuilder<T,U> |
given(NameValueReferable... facts)
Adds one or more facts to the Rule.
|
GivenRuleBuilder<T,U> |
given(NameValueReferableMap facts)
Adds facts to a Rule.
|
GivenRuleBuilder<T,U> |
given(java.lang.String name,
T value)
Adds a fact to the Rule using a name value pair to specify a new fact.
|
ThenRuleBuilder<T,U> |
then(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
Adds an action as a Consumer to the Rule.
|
ThenRuleBuilder<T,U> |
then(java.util.function.Consumer<NameValueReferableTypeConvertibleMap<T>> action)
Adds an action as a Consumer to the Rule.
|
WhenRuleBuilder<T,U> |
when(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
Specifies the condition for the Rule.
|
<S> RuleBuilder<S,U> |
withFactType(java.lang.Class<S> factType)
Specifies the fact type for the Rule being built.
|
<S> RuleBuilder<T,S> |
withResultType(java.lang.Class<S> resultType)
Specifies the Result type for the Rule being built.
|
public static RuleBuilder<java.lang.Object,java.lang.Object> create(java.lang.Class<? extends Rule> ruleClass)
ruleClass
- the class of Rule to buildpublic static RuleBuilder<java.lang.Object,java.lang.Object> create()
public <S> RuleBuilder<S,U> withFactType(java.lang.Class<S> factType)
S
- the type of factsfactType
- the type of facts to be used in the Rulepublic <S> RuleBuilder<T,S> withResultType(java.lang.Class<S> resultType)
S
- the type of ResultresultType
- the type of the Result to be used in the Rulepublic GivenRuleBuilder<T,U> given(java.lang.String name, T value)
name
- the name of the factvalue
- the value of the fact@SafeVarargs public final GivenRuleBuilder<T,U> given(NameValueReferable... facts)
facts
- the facts to be added to the Rulepublic final GivenRuleBuilder<T,U> given(NameValueReferableMap facts)
facts
- the facts to be added to the Rulepublic WhenRuleBuilder<T,U> when(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
condition
- the condition for the Rulepublic ThenRuleBuilder<T,U> then(java.util.function.Consumer<NameValueReferableTypeConvertibleMap<T>> action)
action
- a Consumer action to be added to the Rule that accepts the facts specified for the Rulepublic ThenRuleBuilder<T,U> then(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
action
- a Consumer action to be added to the Rule that accepts the facts and the Result specified
for the Rule