Interface VariableManager
-
- All Known Implementing Classes:
DefaultVariableManager
public interface VariableManager
The variable manager is responsible for keeping track of variable values.- Author:
- Rene Schneider - initial API and implementation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear(boolean aClearConstantsFlag)
Clears all stored variable values.java.util.Map<java.lang.String,java.lang.Object>
dumpVariableState(VariantDefinition aVariant)
Returns all variable entity entries.java.lang.Object
get(Variable aVariable)
Gets a value for a specific variable.java.lang.Object
get(VariableOrConstantEntity anEntity)
Gets a value for a specific variable.void
importVariableState(java.util.Map<java.lang.String,java.lang.Object> aState)
Reads the state as previously exported via#dumpVariableState()
.boolean
isDefined(Variable aVariable)
Checks whether a specific variable has a defined value.boolean
isDefined(VariableOrConstantEntity aVariable)
Checks whether a specific variable has a defined value.void
set(VariableOrConstantEntity anEntity, java.lang.Object aValue)
Sets a value for a specific variable.void
setInitialValueResolverCallback(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)
Provides theVariableManager
with a resolver callback for initial values of variables and constants.void
unset(VariableOrConstantEntity anEntity)
Unsets the specific variable or constant.
-
-
-
Method Detail
-
get
java.lang.Object get(VariableOrConstantEntity anEntity)
Gets a value for a specific variable.- Parameters:
anEntity
- the variable entity- Returns:
- the value or null if none was defined
-
get
java.lang.Object get(Variable aVariable)
Gets a value for a specific variable. This is able to retrieve attribute values out of bean variable values, if necessary.- Parameters:
aVariable
- the variable entity- Returns:
- the value or null if none was defined
-
isDefined
boolean isDefined(VariableOrConstantEntity aVariable)
Checks whether a specific variable has a defined value. Variables with 'null' as their defined value will return true here, even though calling get() on them will yield the same result as if they were not defined.- Parameters:
aVariable
- the variable entity- Returns:
- true if the variable is defined, false if not
-
isDefined
boolean isDefined(Variable aVariable)
Checks whether a specific variable has a defined value. Variables with 'null' as their defined value will return true here, even though calling get() on them will yield the same result as if they were not defined.- Parameters:
aVariable
- the variable entity- Returns:
- true if the variable is defined, false if not
-
set
void set(VariableOrConstantEntity anEntity, java.lang.Object aValue)
Sets a value for a specific variable. This is also used to define constants, as constants are technically alsoVariableEntity
instances (- Parameters:
anEntity
- the variable entityaValue
- the value to set
-
setInitialValueResolverCallback
void setInitialValueResolverCallback(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)
Provides theVariableManager
with a resolver callback for initial values of variables and constants. If the manager is asked for the value of a not-yet-knownVariableOrConstantEntity
, it may use this callback (if one is present) to trigger a definition of the value in question. It should however never rely on anything to be defined in this case. Execution of callback invocations can be expected to be synchronous.- Parameters:
aResolver
- the callback to use
-
unset
void unset(VariableOrConstantEntity anEntity)
Unsets the specific variable or constant.- Parameters:
anEntity
- the variable entity
-
clear
void clear(boolean aClearConstantsFlag)
Clears all stored variable values.- Parameters:
aClearConstantsFlag
- Whether to clear constants as well. If false, only actual variables are cleared.
-
dumpVariableState
java.util.Map<java.lang.String,java.lang.Object> dumpVariableState(VariantDefinition aVariant)
Returns all variable entity entries.- Returns:
-
importVariableState
void importVariableState(java.util.Map<java.lang.String,java.lang.Object> aState)
Reads the state as previously exported via#dumpVariableState()
. This is additive, meaning it does not remove non-mentioned variables.
-
-