Package de.gebit.integrity.parameter.variables

## 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.
    `Map<String,​Object>` | `dumpVariableState​(VariantDefinition aVariant)` | Returns all variable entity entries.
    `Object` | `get​(Variable aVariable)` | Gets a value for a specific variable.
    `Object` | `get​(VariableOrConstantEntity anEntity)` | Gets a value for a specific variable.
    `void` | `importVariableState​(Map<String,​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, Object aValue)` | Sets a value for a specific variable.
    `void` | `setInitialValueResolverCallback​(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)` | Provides the `VariableManager` with a resolver callback for initial values of variables and constants.
    `void` | `unset​(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 also `VariableEntity` instances (
      Parameters:
        `anEntity` - the variable entity
        `aValue` - the value to set

    - #### setInitialValueResolverCallback

          void setInitialValueResolverCallback​(VariableOrConstantEntityInitialValueDefinitionCallback aResolver)

      Provides the `VariableManager` with a resolver callback for initial values of variables and constants. If the manager is asked for the value of a not-yet-known `VariableOrConstantEntity`, 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:

    - #### importVariableState

          void importVariableState​(Map<String,​Object> aState)

      Reads the state as previously exported via `#dumpVariableState()`. This is additive, meaning it does not remove non-mentioned variables.