Interface RuleCompilerContext
- All Known Implementing Classes:
DefaultRuleCompilerContext
public interface RuleCompilerContext
This interface represents the context valid for the compilation of a rule. It is passed to, and potentially modified
by, each phase of the compilation process.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddProblem(RuleCompilerProblem problem) Adds a problem arose during compilation process to the list.A shortcut toRuleIrVariablesGenerator.createLocalContainer().generateLocalVariable(RuleIrLocalVariablesContainer container, Class<?> type) generateVariable(Class<?> type) A shortcut toRuleIrVariablesGenerator.generateVariable(Class).Returns action definitions for ruleReturns a mutableMapthat can be used to store attributes associated with thisRuleCompilerContext.Returns condition definitions for ruleReturns all failure causing exceptions for thisRuleCompilerContext.Returns the rules module name.Returns all problems arose during compilation process.getRule()Returns the rule.get Rules compilation context for a given compilationReturns rule conditions for ruleReturns the rule parameters.longReturns the rule version.Returns the variables generator valid for this compiler context.voidsetRuleVersion(long version) Provides means of setting engine version of the rule.
-
Method Details
-
getRule
AbstractRuleModel getRule()Returns the rule.- Returns:
- rule
-
getRuleVersion
long getRuleVersion()Returns the rule version.- Returns:
- engine rule version
-
setRuleVersion
void setRuleVersion(long version) Provides means of setting engine version of the rule.- Parameters:
version- - engine rule version
-
getModuleName
String getModuleName()Returns the rules module name.- Returns:
- rules module name
-
getRuleParameters
List<RuleParameterData> getRuleParameters()Returns the rule parameters.- Returns:
- The rule parameters
-
getVariablesGenerator
RuleIrVariablesGenerator getVariablesGenerator()Returns the variables generator valid for this compiler context.- Returns:
- the variables generator
-
generateVariable
A shortcut toRuleIrVariablesGenerator.generateVariable(Class).- Parameters:
type- - the type- Returns:
- the name of the variable
-
createLocalContainer
RuleIrLocalVariablesContainer createLocalContainer()A shortcut toRuleIrVariablesGenerator.createLocalContainer().- Returns:
- the current container
-
generateLocalVariable
- Parameters:
type- - the type- Returns:
- the name of the variable
-
getAttributes
Returns a mutableMapthat can be used to store attributes associated with thisRuleCompilerContext.- Returns:
- the map containing the attributes
-
getFailureExceptions
Returns all failure causing exceptions for thisRuleCompilerContext. -
getProblems
List<RuleCompilerProblem> getProblems()Returns all problems arose during compilation process. -
addProblem
Adds a problem arose during compilation process to the list.- Parameters:
problem-
-
getConditionDefinitions
Map<String,RuleConditionDefinitionData> getConditionDefinitions()Returns condition definitions for rule -
getActionDefinitions
Map<String,RuleActionDefinitionData> getActionDefinitions()Returns action definitions for rule -
getRuleConditions
List<RuleConditionData> getRuleConditions()Returns rule conditions for rule -
getRuleCompilationContext
RuleCompilationContext getRuleCompilationContext()get Rules compilation context for a given compilation- Returns:
- instance of
RuleCompilationContext
-