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 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 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

        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.