Package org.teiid.query.sql.util
Class VariableContext
- java.lang.Object
-
- org.teiid.query.sql.util.VariableContext
-
public class VariableContext extends Object
-
-
Constructor Summary
Constructors Constructor Description VariableContext()
Constructor for VariableContext.VariableContext(boolean delegateSets)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsVariable(Object variable)
Check if this context or any of it's parent contexts contain this variablevoid
getFlattenedContextMap(Map values)
Helper MethodsObject
getGlobalValue(String variable)
List<Object>
getLocalValues()
VariableContext
getParentContext()
Get the parent context for this variable context.Object
getValue(Object variable)
Get the value for the given variable, if the variable exits in the current context just return the value of the variable else lookup the parent context and return the value of the variable.Map<Object,Object>
getVariableMap()
boolean
isEmpty()
Check if the current context and its parents contain any variablesvoid
putAll(VariableContext other)
Object
remove(Object symbol)
void
setGlobalValue(String variable, Object value)
void
setParentContext(VariableContext parent)
Set the parent variable context for this variable context, when looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup.Object
setValue(Object variable, Object value)
Set the value for the given, if the variable already exits replaces its value with the given value else adds a new variable to the map.String
toString()
-
-
-
Method Detail
-
getGlobalValue
public Object getGlobalValue(String variable) throws TeiidComponentException
- Throws:
TeiidComponentException
-
setValue
public Object setValue(Object variable, Object value)
Set the value for the given, if the variable already exits replaces its value with the given value else adds a new variable to the map.- Parameters:
variable
- TheElementSymbol
to be added as a variable.value
- The value to be set for the given variable.
-
getValue
public Object getValue(Object variable)
Get the value for the given variable, if the variable exits in the current context just return the value of the variable else lookup the parent context and return the value of the variable.- Parameters:
variable
- TheElementSymbol
whose value needs to be returned.- Returns:
- The value of the given variable
-
setParentContext
public void setParentContext(VariableContext parent)
Set the parent variable context for this variable context, when looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup.- Parameters:
parent
- The parentVariableContext
.
-
getParentContext
public VariableContext getParentContext()
Get the parent context for this variable context. When looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup.- Returns:
- The parent
VariableContext
.
-
getFlattenedContextMap
public void getFlattenedContextMap(Map values)
Helper Methods
-
containsVariable
public boolean containsVariable(Object variable)
Check if this context or any of it's parent contexts contain this variable- Parameters:
variable
- The variable which may be present on this context- Returns:
- A boolean value indiating if the given variable is present on this context or any of it's parent contexts.
-
isEmpty
public boolean isEmpty()
Check if the current context and its parents contain any variables- Returns:
- A boolean bollean value indicating if this context is empty
-
clear
public void clear()
-
putAll
public void putAll(VariableContext other)
-
-