Class VariableStore
- java.lang.Object
-
- org.apache.torque.generator.variable.VariableStore
-
public class VariableStore extends Object
Stores all variables which are currently accessible.
-
-
Constructor Summary
Constructors Constructor Description VariableStore()
-
Method Summary
Modifier and Type Method Description void
clear()
Removes all variables from this store.void
endFile()
Signals this store that the processing of one file has ended.void
endGeneration()
Signals this store that generation has ended.void
endOutlet()
Signals this store that the processing of a outlet has ended.QualifiedNameMap<Variable>
getContent()
Returns a map with the variables contained in this store.Variable
getInHierarchy(QualifiedName key)
Returns the most specific variable which is visible from the key's namespace and has the same name as the key's name.void
remove(Variable variable)
removes a variable from the store.void
set(Variable variable)
Sets a variable.void
startOutlet()
Signals this store that the processing of a outlet has started.
-
-
-
Method Detail
-
set
public void set(Variable variable)
Sets a variable.- Parameters:
variable
- the variable to set.- Throws:
NullPointerException
- if variable is null.
-
remove
public void remove(Variable variable)
removes a variable from the store.- Parameters:
variable
- the variable to remove, not null.- Throws:
NullPointerException
- if variable is null.
-
startOutlet
public void startOutlet()
Signals this store that the processing of a outlet has started.
-
endOutlet
public void endOutlet()
Signals this store that the processing of a outlet has ended. Removes all variables with the scopeVariable.Scope.OUTLET
, and all variables with the scopeVariable.Scope.CHILDREN
which were set by the outlet which processing ended.
-
endFile
public void endFile()
Signals this store that the processing of one file has ended. Removes all variables with the scopeFILE
.
-
endGeneration
public void endGeneration()
Signals this store that generation has ended. Removes the variables from all scopes.
-
clear
public void clear()
Removes all variables from this store.
-
getContent
public QualifiedNameMap<Variable> getContent()
Returns a map with the variables contained in this store. Note that if one variable is hidden by another with a more specific scope, only the variable with the more specific scope is returned.The Map is not backed by this stores, i.e. adding and removing variables to the returned nmap has no effect on this store. However, the variables in the returned map are the variables in this store, i.e. setting the value of the variable will change the variable in this store.
Note: The current store content is rebuilt each time this method is called. For this reason,
store.getInHierarchy(qualifiedName)
is much faster thanstore.getContent().get(qualifiedName)
.- Returns:
- a map with the variables contained ins this store, never null.
-
getInHierarchy
public Variable getInHierarchy(QualifiedName key)
Returns the most specific variable which is visible from the key's namespace and has the same name as the key's name. if several most specific variables are found in the different scopes, the one with the most specific scope is returned.- Parameters:
key
- The key for the variable.- Returns:
- the most specific matching variable, or null if no variable matches.
-
-