public class GlobalLocalVariables extends java.lang.Object implements VariableContainer
Constructor and Description |
---|
GlobalLocalVariables()
Initialize the new instance with default values.
|
Modifier and Type | Method and Description |
---|---|
protected VariableContainer |
getGlobalVars() |
protected VariableContainer |
getLocalVars() |
java.lang.Object |
getValue(java.lang.String varName)
Returns the value for the variable with the given name.
|
protected VariableContainer |
globalVariables() |
boolean |
isKnownVariable(java.lang.String varName)
Returns if the variable with the given name can be resolved by the receiver.
|
java.util.Set<java.lang.String> |
knownVariableNames()
Returns all variable name the resolver currently knows
|
protected VariableContainer |
localVariables() |
void |
newGlobalContext(VariableContainer varContainer)
Initialize the global variable container with an new container.
|
void |
newLocalContext(VariableContainer varContainer)
Initialize the local variable container with an new container.
|
void |
removeVariable(java.lang.String varName)
Remove the variable with the specified name.
|
void |
set(java.lang.String varName,
java.lang.String value,
boolean global)
Set the variable with the given name to the specified value.
|
void |
setGlobal(java.lang.String varName,
java.lang.String value)
Set the global variable with the given name to the specified value.
|
void |
setGlobalFrom(java.util.Properties vars)
Adds all given name/value pairs from the given properties
to the global variables.
|
void |
setGlobalObject(java.lang.String varName,
java.lang.Object value)
Set the global variable with the given name to the specified value.
|
protected void |
setGlobalVars(VariableContainer newValue) |
void |
setLocal(java.lang.String varName,
java.lang.String value)
Set the local variable with the given name to the specified value.
|
void |
setLocalFrom(java.util.Properties vars)
Adds all given name/value pairs from the given properties
to the local variables.
|
void |
setLocalObject(java.lang.String varName,
java.lang.Object value)
Set the local variable with the given name to the specified value.
|
protected void |
setLocalVars(VariableContainer newValue) |
void |
setValue(java.lang.String varName,
java.lang.String value)
Set the value of the specified variable.
|
void |
setValueFor(java.lang.String varName,
java.lang.Object value)
Sets the value of the variable with the given name.
|
protected void |
setVariablesFrom(java.util.Properties vars,
boolean global)
Adds all given name/value pairs from the given properties
to the global or local variables as specified.
|
public GlobalLocalVariables()
public void newLocalContext(VariableContainer varContainer)
varContainer
- The new container (must not be null)public void newGlobalContext(VariableContainer varContainer)
varContainer
- The new container (must not be null)public void set(java.lang.String varName, java.lang.String value, boolean global)
varName
- The name of the variablevalue
- The value to be assigned to the variableglobal
- Defines whether or not the variable is globalpublic void setLocal(java.lang.String varName, java.lang.String value)
varName
- The name of a local variablevalue
- The value to be assigned to the variablepublic void setLocalObject(java.lang.String varName, java.lang.Object value)
varName
- The name of a local variablevalue
- The value to be assigned to the variablepublic void setGlobal(java.lang.String varName, java.lang.String value)
varName
- The name of a local variablevalue
- The value to be assigned to the variablepublic void setGlobalObject(java.lang.String varName, java.lang.Object value)
varName
- The name of a local variablevalue
- The value to be assigned to the variablepublic void setGlobalFrom(java.util.Properties vars)
public void setLocalFrom(java.util.Properties vars)
public void setValue(java.lang.String varName, java.lang.String value)
setValue
in interface VariableContainer
varName
- The name under which the value has to be storedvalue
- The value to storepublic void setValueFor(java.lang.String varName, java.lang.Object value)
setValueFor
in interface VariableContainer
varName
- The case sensitive name of the variable. Must not be null !value
- The new value of the variable. Must not be null !public void removeVariable(java.lang.String varName)
removeVariable
in interface VariableContainer
varName
- The name of the variable to be removedpublic java.util.Set<java.lang.String> knownVariableNames()
knownVariableNames
in interface VariableResolver
public java.lang.Object getValue(java.lang.String varName) throws UnknownVariableException
getValue
in interface VariableResolver
varName
- The case sensitive name of the variable.UnknownVariableException
- The receiver is not knowing the variable.public boolean isKnownVariable(java.lang.String varName)
isKnownVariable
in interface VariableResolver
varName
- The case sensitive name of the variable.protected void setVariablesFrom(java.util.Properties vars, boolean global)
protected VariableContainer localVariables()
protected VariableContainer globalVariables()
protected VariableContainer getGlobalVars()
protected void setGlobalVars(VariableContainer newValue)
protected VariableContainer getLocalVars()
protected void setLocalVars(VariableContainer newValue)