Package org.ocpsoft.rewrite.config
Class RuleBuilder
java.lang.Object
org.ocpsoft.rewrite.config.RuleBuilder
- All Implemented Interfaces:
org.ocpsoft.common.pattern.Weighted,CompositeCondition,CompositeOperation,CompositeRule,Condition,Operation,Relocatable,RelocatableRule,Rule,Context,Parameterized,ParameterizedRule
public final class RuleBuilder
extends Object
implements ParameterizedRule, RelocatableRule, CompositeCondition, CompositeOperation, CompositeRule, Context
Builder for fluently defining new composite
Rule instances.- Author:
- Lincoln Baxter, III
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method will call the supplied visitor for all conditions attached to the rule builder.voidclear()Clear the contents of this context and reset to a "like-new" state.protected StringbooleancontainsKey(Object key) Returntrueif this context contains an entry with the given key.static RuleBuilderdefine()Returns a newRuleBuilderinstance.static RuleBuilderReturns a newRuleBuilderinstance, set with the givenRuleID.booleanevaluate(Rewrite event, EvaluationContext context) Evaluate this condition against the givenRewriteevent.Get the value in the context map defined by the given key.Return the underlyingConditionBuilderReturns allConditionobjects contained within thisCompositeCondition; otherwise, returns an emptyList.getId()Get the ID for thisRuleReturn the underlyingOperationBuilderReturns allOperationobjects contained within thisCompositeOperation; otherwise, returns an emptyList.Return theParameterStorefor thisRuleGet all requiredParameternames for thisParameterizedinstance.getRules()Returns a list ofRuleinstances contained by thisCompositeRule.booleanReturns true if this object should be relocated, or has been relocated.protected Stringvoidperform(Rewrite event, EvaluationContext context) Perform theOperation.intpriority()voidStore a key value pair into the context.voidsetParameterStore(ParameterStore store) Initialize thisParameterizedinstance with the globalParameterStore.toString()Set the ID of thisRuleinstance.withPriority(int priority) Set the priority of thisRuleinstance.static RuleBuilderReturns a newRuleBuilderinstance wrapping the givenRule.
-
Field Details
-
contextMap
-
-
Method Details
-
define
Returns a newRuleBuilderinstance. -
wrap
Returns a newRuleBuilderinstance wrapping the givenRule. -
define
Returns a newRuleBuilderinstance, set with the givenRuleID. -
withId
Set the ID of thisRuleinstance. -
withPriority
Set the priority of thisRuleinstance. Ifpriority()differs from the priority of theConfigurationProviderfrom which this rule was returned, then relocate this rule to its new priority position in the compiled rule set. -
when
-
perform
-
evaluate
Description copied from interface:ConditionEvaluate this condition against the givenRewriteevent. If this condition does not apply to the given event, it must return false. If the condition applies and is satisfied, return true. -
perform
Description copied from interface:OperationPerform theOperation. -
getId
Description copied from interface:RuleGet the ID for thisRule -
priority
public int priority()- Specified by:
priorityin interfaceorg.ocpsoft.common.pattern.Weighted
-
isRelocated
public boolean isRelocated()Description copied from interface:RelocatableReturns true if this object should be relocated, or has been relocated.- Specified by:
isRelocatedin interfaceRelocatable
-
getConditionBuilder
Return the underlyingConditionBuilder -
getOperationBuilder
Return the underlyingOperationBuilder -
accept
This method will call the supplied visitor for all conditions attached to the rule builder.- Parameters:
visitor- visitor to process
-
getOperations
Description copied from interface:CompositeOperationReturns allOperationobjects contained within thisCompositeOperation; otherwise, returns an emptyList.- Specified by:
getOperationsin interfaceCompositeOperation
-
getConditions
Description copied from interface:CompositeConditionReturns allConditionobjects contained within thisCompositeCondition; otherwise, returns an emptyList.- Specified by:
getConditionsin interfaceCompositeCondition
-
getRules
Description copied from interface:CompositeRuleReturns a list ofRuleinstances contained by thisCompositeRule.- Specified by:
getRulesin interfaceCompositeRule
-
getParameterStore
Description copied from interface:ParameterizedRuleReturn theParameterStorefor thisRule- Specified by:
getParameterStorein interfaceParameterizedRule
-
where
-
clear
public void clear()Description copied from interface:ContextClear the contents of this context and reset to a "like-new" state. -
get
Description copied from interface:ContextGet the value in the context map defined by the given key. Returnnullif no such key exists, or if they key maps to anullvalue. -
put
Description copied from interface:ContextStore a key value pair into the context. -
containsKey
Description copied from interface:ContextReturntrueif this context contains an entry with the given key.- Specified by:
containsKeyin interfaceContext
-
getRequiredParameterNames
Description copied from interface:ParameterizedGet all requiredParameternames for thisParameterizedinstance.- Specified by:
getRequiredParameterNamesin interfaceParameterized
-
setParameterStore
Description copied from interface:ParameterizedInitialize thisParameterizedinstance with the globalParameterStore.- Specified by:
setParameterStorein interfaceParameterized
-
toString
-
conditionToString
-
operationToString
-