Interface VariableManager
-
- All Known Implementing Classes:
DefaultVariableManager
public interface VariableManagerThe 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 voidclear(boolean aClearConstantsFlag)Clears all stored variable values.Map<String,Object>dumpVariableState(VariantDefinition aVariant)Returns all variable entity entries.Objectget(Variable aVariable)Gets a value for a specific variable.Objectget(VariableOrConstantEntity anEntity)Gets a value for a specific variable.voidimportVariableState(Map<String,Object> aState)Reads the state as previously exported via#dumpVariableState().booleanisDefined(Variable aVariable)Checks whether a specific variable has a defined value.booleanisDefined(VariableOrConstantEntity aVariable)Checks whether a specific variable has a defined value.voidset(VariableOrConstantEntity anEntity, Object aValue)Sets a value for a specific variable.voidsetInitialValueResolverCallback(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)Provides theVariableManagerwith a resolver callback for initial values of variables and constants.voidunset(VariableOrConstantEntity anEntity)Unsets the specific variable or constant.
-
-
-
Method Detail
-
get
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
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, Object aValue)
Sets a value for a specific variable. This is also used to define constants, as constants are technically alsoVariableEntityinstances (- Parameters:
anEntity- the variable entityaValue- the value to set
-
setInitialValueResolverCallback
void setInitialValueResolverCallback(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)
Provides theVariableManagerwith 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
Map<String,Object> dumpVariableState(VariantDefinition aVariant)
Returns all variable entity entries.- Returns:
-
-