Class DefaultRuleIrVariablesGenerator
- java.lang.Object
-
- de.hybris.platform.ruleengineservices.compiler.impl.DefaultRuleIrVariablesGenerator
-
- All Implemented Interfaces:
RuleIrVariablesGenerator
public class DefaultRuleIrVariablesGenerator extends java.lang.Object implements RuleIrVariablesGenerator
Default implementation ofRuleIrVariablesGenerator
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_VARIABLE_PREFIX-
Fields inherited from interface de.hybris.platform.ruleengineservices.compiler.RuleIrVariablesGenerator
CONTAINER_PATH_SEPARATOR, DEFAULT_VARIABLES_CONTAINER_ID
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleIrVariablesGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseContainer()Closes the current container.RuleIrVariablesContainercreateContainer(java.lang.String id)Creates a new container and uses the current one as parent.RuleIrLocalVariablesContainercreateLocalContainer()Creates a new local container.protected RuleIrVariablefindVariable(RuleIrVariablesContainer container, java.lang.Class<?> type)java.lang.StringgenerateLocalVariable(RuleIrLocalVariablesContainer container, java.lang.Class<?> type)Generates a new variable for the given local container and type.java.lang.StringgenerateVariable(java.lang.Class<?> type)Generates a new variable for the given type.protected java.lang.StringgenerateVariableName(java.lang.Class<?> type)RuleIrVariablesContainergetCurrentContainer()Returns the current container.RuleIrVariablesContainergetRootContainer()Returns the root container.
-
-
-
Field Detail
-
DEFAULT_VARIABLE_PREFIX
public static final java.lang.String DEFAULT_VARIABLE_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootContainer
public RuleIrVariablesContainer getRootContainer()
Description copied from interface:RuleIrVariablesGeneratorReturns the root container.- Specified by:
getRootContainerin interfaceRuleIrVariablesGenerator- Returns:
- the root container
-
getCurrentContainer
public RuleIrVariablesContainer getCurrentContainer()
Description copied from interface:RuleIrVariablesGeneratorReturns the current container.- Specified by:
getCurrentContainerin interfaceRuleIrVariablesGenerator- Returns:
- the current container
-
createContainer
public RuleIrVariablesContainer createContainer(java.lang.String id)
Description copied from interface:RuleIrVariablesGeneratorCreates a new container and uses the current one as parent. The new container is set as the current one.- Specified by:
createContainerin interfaceRuleIrVariablesGenerator- Parameters:
id- - the id for the new container- Returns:
- the current container
-
closeContainer
public void closeContainer()
Description copied from interface:RuleIrVariablesGeneratorCloses the current container. The parent container is set as the current one.- Specified by:
closeContainerin interfaceRuleIrVariablesGenerator
-
generateVariable
public java.lang.String generateVariable(java.lang.Class<?> type)
Description copied from interface:RuleIrVariablesGeneratorGenerates a new variable for the given type. If a variable already exists for the given type in the current container or any of the parent containers, it will be used. If not, a new one will be created in the current container.- Specified by:
generateVariablein interfaceRuleIrVariablesGenerator- Parameters:
type- - the type- Returns:
- the name of the variable
-
findVariable
protected RuleIrVariable findVariable(RuleIrVariablesContainer container, java.lang.Class<?> type)
-
createLocalContainer
public RuleIrLocalVariablesContainer createLocalContainer()
Description copied from interface:RuleIrVariablesGeneratorCreates a new local container.- Specified by:
createLocalContainerin interfaceRuleIrVariablesGenerator- Returns:
- the current container
-
generateLocalVariable
public java.lang.String generateLocalVariable(RuleIrLocalVariablesContainer container, java.lang.Class<?> type)
Description copied from interface:RuleIrVariablesGeneratorGenerates a new variable for the given local container and type.- Specified by:
generateLocalVariablein interfaceRuleIrVariablesGeneratortype- - the type- Returns:
- the name of the variable
-
generateVariableName
protected java.lang.String generateVariableName(java.lang.Class<?> type)
-
-