Interface RuleIrVariablesGenerator
-
- All Known Implementing Classes:
DefaultRuleIrVariablesGenerator
public interface RuleIrVariablesGeneratorImplementations of this interface are responsible for generating variables.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTAINER_PATH_SEPARATORstatic java.lang.StringDEFAULT_VARIABLES_CONTAINER_ID
-
Method Summary
All Methods Instance Methods Abstract 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.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.RuleIrVariablesContainergetCurrentContainer()Returns the current container.RuleIrVariablesContainergetRootContainer()Returns the root container.
-
-
-
Field Detail
-
DEFAULT_VARIABLES_CONTAINER_ID
static final java.lang.String DEFAULT_VARIABLES_CONTAINER_ID
- See Also:
- Constant Field Values
-
CONTAINER_PATH_SEPARATOR
static final java.lang.String CONTAINER_PATH_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootContainer
RuleIrVariablesContainer getRootContainer()
Returns the root container.- Returns:
- the root container
-
getCurrentContainer
RuleIrVariablesContainer getCurrentContainer()
Returns the current container.- Returns:
- the current container
-
createContainer
RuleIrVariablesContainer createContainer(java.lang.String id)
Creates a new container and uses the current one as parent. The new container is set as the current one.- Parameters:
id- - the id for the new container- Returns:
- the current container
-
closeContainer
void closeContainer()
Closes the current container. The parent container is set as the current one.
-
generateVariable
java.lang.String generateVariable(java.lang.Class<?> type)
Generates 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.- Parameters:
type- - the type- Returns:
- the name of the variable
-
createLocalContainer
RuleIrLocalVariablesContainer createLocalContainer()
Creates a new local container.- Returns:
- the current container
-
generateLocalVariable
java.lang.String generateLocalVariable(RuleIrLocalVariablesContainer container, java.lang.Class<?> type)
Generates a new variable for the given local container and type.- Parameters:
type- - the type- Returns:
- the name of the variable
-
-