public final class RuleBuilder extends Object implements ParameterizedRule, RelocatableRule, CompositeCondition, CompositeOperation, CompositeRule, Context
Rule instances.| Modifier and Type | Field and Description |
|---|---|
protected Map<Object,Object> |
contextMap |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor<Condition> visitor)
This method will call the supplied visitor for all conditions attached to the rule builder.
|
void |
clear()
Clear the contents of this context and reset to a "like-new" state.
|
protected String |
conditionToString() |
boolean |
containsKey(Object key)
Return
true if this context contains an entry with the given key. |
static RuleBuilder |
define()
Returns a new
RuleBuilder instance. |
static RuleBuilder |
define(String id)
Returns a new
RuleBuilder instance, set with the given Rule ID. |
boolean |
evaluate(Rewrite event,
EvaluationContext context)
Evaluate this condition against the given
Rewrite event. |
Object |
get(Object key)
Get the value in the context map defined by the given key.
|
DefaultConditionBuilder |
getConditionBuilder()
Return the underlying
ConditionBuilder |
List<Condition> |
getConditions()
Returns all
Condition objects contained within this CompositeCondition; otherwise, returns an
empty List. |
String |
getId()
Get the ID for this
Rule |
DefaultOperationBuilder |
getOperationBuilder()
Return the underlying
OperationBuilder |
List<Operation> |
getOperations()
Returns all
Operation objects contained within this CompositeOperation; otherwise, returns an
empty List. |
ParameterStore |
getParameterStore()
Return the
ParameterStore for this Rule |
Set<String> |
getRequiredParameterNames()
Get all required
Parameter names for this Parameterized instance. |
List<Rule> |
getRules()
Returns a list of
Rule instances contained by this CompositeRule. |
boolean |
isRelocated()
Returns true if this object should be relocated, or has been relocated.
|
protected String |
operationToString() |
RuleBuilder |
perform(Operation operation)
|
void |
perform(Rewrite event,
EvaluationContext context)
Perform the
Operation. |
int |
priority() |
void |
put(Object key,
Object value)
Store a key value pair into the context.
|
void |
setParameterStore(ParameterStore store)
Initialize this
Parameterized instance with the global ParameterStore. |
String |
toString() |
RuleBuilder |
when(Condition condition)
|
ConfigurableParameter<?> |
where(String name) |
RuleBuilder |
withId(String id)
Set the ID of this
Rule instance. |
RuleBuilder |
withPriority(int priority)
Set the priority of this
Rule instance. |
static RuleBuilder |
wrap(Rule rule)
Returns a new
RuleBuilder instance wrapping the given Rule. |
public static RuleBuilder define()
RuleBuilder instance.public static RuleBuilder wrap(Rule rule)
RuleBuilder instance wrapping the given Rule.public static RuleBuilder define(String id)
RuleBuilder instance, set with the given Rule ID.public RuleBuilder withId(String id)
Rule instance.public RuleBuilder withPriority(int priority)
Rule instance. If priority() differs from the priority of the
ConfigurationProvider from which this rule was returned, then relocate this rule to its new priority
position in the compiled rule set.public RuleBuilder when(Condition condition)
public RuleBuilder perform(Operation operation)
public boolean evaluate(Rewrite event, EvaluationContext context)
ConditionRewrite event. If this condition does
not apply to the given event, it must return false. If the condition applies and is satisfied, return true.public void perform(Rewrite event, EvaluationContext context)
OperationOperation.public int priority()
priority in interface org.ocpsoft.common.pattern.Weightedpublic boolean isRelocated()
RelocatableisRelocated in interface Relocatablepublic DefaultConditionBuilder getConditionBuilder()
ConditionBuilderpublic DefaultOperationBuilder getOperationBuilder()
OperationBuilderpublic void accept(Visitor<Condition> visitor)
visitor - visitor to processpublic List<Operation> getOperations()
CompositeOperationOperation objects contained within this CompositeOperation; otherwise, returns an
empty List.getOperations in interface CompositeOperationpublic List<Condition> getConditions()
CompositeConditionCondition objects contained within this CompositeCondition; otherwise, returns an
empty List.getConditions in interface CompositeConditionpublic List<Rule> getRules()
CompositeRuleRule instances contained by this CompositeRule.getRules in interface CompositeRulepublic ParameterStore getParameterStore()
ParameterizedRuleParameterStore for this RulegetParameterStore in interface ParameterizedRulepublic ConfigurableParameter<?> where(String name)
public void clear()
Contextpublic Object get(Object key)
Contextnull if no such key exists, or if
they key maps to a null value.public void put(Object key, Object value)
Contextpublic boolean containsKey(Object key)
Contexttrue if this context contains an entry with the given key.containsKey in interface Contextpublic Set<String> getRequiredParameterNames()
ParameterizedParameter names for this Parameterized instance.getRequiredParameterNames in interface Parameterizedpublic void setParameterStore(ParameterStore store)
ParameterizedParameterized instance with the global ParameterStore.setParameterStore in interface Parameterizedprotected String conditionToString()
protected String operationToString()
Copyright © 2021 OCPsoft. All rights reserved.