Package de.gebit.integrity.parameter.resolving

## Class DefaultParameterResolver

- java.lang.Object
- - de.gebit.integrity.parameter.resolving.DefaultParameterResolver

- All Implemented Interfaces:
    `ParameterResolver`

      public class DefaultParameterResolver
      extends Object
      implements ParameterResolver

  The default implementation of a parameter resolver.
  Author:
    Rene Schneider - initial API and implementation

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected StandardOperationProcessor` | `standardOperationProcessor` | The processor for standard operations.
    `protected VariableManager` | `variableManager` | The variable manager to use.
    `protected WrapperFactory` | `wrapperFactory` | The wrapper factory to use.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultParameterResolver()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Map<String,​Object>` | `createExpectedResultMap​(Test aTest, boolean anIncludeArbitraryResultFlag)` | Returns a map of named results as expected by the given `Test`.
    `Map<String,​Object>` | `createParameterMap​(Call aCall, boolean anIncludeArbitraryParametersFlag, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Returns a map mapping a parameter name to a value, exploring a given `Call` to determine the valid parameters.
    `Map<String,​Object>` | `createParameterMap​(TableTest aTableTest, TableTestRow aTableTestRow, TableTestParameterResolveMethod aResolveMethod, boolean anIncludeArbitraryParametersFlag, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Returns a map mapping a parameter name to a value, exploring a given row of a `TableTest` to determine the valid parameters.
    `Map<String,​Object>` | `createParameterMap​(Test aTest, boolean anIncludeArbitraryParametersFlag, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Returns a map mapping a parameter name to a value, exploring a given `Test` to determine the valid parameters.
    `Map<String,​Object>` | `createParameterMap​(List<Parameter> someParameters, boolean anIncludeArbitraryParametersFlag, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Returns a map mapping a parameter name to a value, using a list of `Parameter` instances to determine the valid parameters.
    `boolean` | `isSafelyStaticallyResolvable​(ValueOrEnumValueOrOperationCollection aValue, VariantDefinition aVariant)` | Determines whether the given `ValueOrEnumValueOrOperationCollection` is safely resolvable to a value in a static way, that is, not requiring a current execution context.
    `boolean` | `isSafelyStaticallyResolvable​(ValueOrEnumValueOrOperation aValue, VariantDefinition aVariant)` | Determines whether the given `ValueOrEnumValueOrOperation` is safely resolvable to a value in a static way, that is, not requiring a current execution context.
    `Object` | `resolveParameterValue​(ValueOrEnumValueOrOperationCollection aValueCollection, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Resolves the given `ValueOrEnumValueOrOperationCollection`, using the variable map given.
    `Object` | `resolveSingleParameterValue​(ValueOrEnumValueOrOperation aValue, UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)` | Resolves the given `ValueOrEnumValueOrOperation`, using the variable map given.
    `Object` | `resolveStatically​(ConstantDefinition aConstant, VariantDefinition aVariant)` | Resolves a constant definition to its defined value, which may depend on the active variant.
    `Object` | `resolveStatically​(ValueOrEnumValueOrOperationCollection aValue, VariantDefinition aVariant)` | Resolves a `ValueOrEnumValueOrOperationCollection` to its actual value statically, that is, not requiring a current test execution context.
    `Object` | `resolveStatically​(ValueOrEnumValueOrOperation aValue, VariantDefinition aVariant)` | Resolves a `ValueOrEnumValueOrOperation` to its actual value statically, that is, not requiring a current test execution context.
    `Object` | `resolveStatically​(VariableOrConstantEntity anEntity, VariantDefinition aVariant)` | Resolves a variable (recursively, if necessary) to its actual value.
    `Object` | `resolveStatically​(Variable aVariable, VariantDefinition aVariant)` | Resolves a variable (recursively, if necessary) to its actual value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### wrapperFactory

          @Inject(optional=true)
          protected WrapperFactory wrapperFactory

      The wrapper factory to use.

    - #### variableManager

          @Inject(optional=true)
          protected VariableManager variableManager

      The variable manager to use.

    - #### standardOperationProcessor

          @Inject
          protected StandardOperationProcessor standardOperationProcessor

      The processor for standard operations.

  - ### Constructor Detail

    - #### DefaultParameterResolver

          public DefaultParameterResolver()

  - ### Method Detail

    - #### createParameterMap

          public Map<String,​Object> createParameterMap​(Test aTest,
                                                             boolean anIncludeArbitraryParametersFlag,
                                                             UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                      throws ClassNotFoundException,
                                                             UnexecutableException,
                                                             InstantiationException

      Description copied from interface: `ParameterResolver`
      Returns a map mapping a parameter name to a value, exploring a given `Test` to determine the valid parameters. Parameters that contain references to variables will be resolved if the variable map is provided, but no type conversions will be done.
      Specified by:
        `createParameterMap` in interface `ParameterResolver`
      Parameters:
        `aTest` - the test
        `anIncludeArbitraryParametersFlag` - whether arbitrary parameters should be determined and included as well
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        a map with a String to value mapping
      Throws:
        `ClassNotFoundException`
        `UnexecutableException`
        `InstantiationException`

    - #### createParameterMap

          public Map<String,​Object> createParameterMap​(Call aCall,
                                                             boolean anIncludeArbitraryParametersFlag,
                                                             UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                      throws ClassNotFoundException,
                                                             UnexecutableException,
                                                             InstantiationException

      Description copied from interface: `ParameterResolver`
      Returns a map mapping a parameter name to a value, exploring a given `Call` to determine the valid parameters. Parameters that contain references to variables will be resolved if the variable map is provided, but no type conversions will be done.
      Specified by:
        `createParameterMap` in interface `ParameterResolver`
      Parameters:
        `aCall` - the call
        `anIncludeArbitraryParametersFlag` - whether arbitrary parameters should be determined and included as well
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        a map with a String to value mapping
      Throws:
        `ClassNotFoundException`
        `UnexecutableException`
        `InstantiationException`

    - #### createParameterMap

          public Map<String,​Object> createParameterMap​(TableTest aTableTest,
                                                             TableTestRow aTableTestRow,
                                                             TableTestParameterResolveMethod aResolveMethod,
                                                             boolean anIncludeArbitraryParametersFlag,
                                                             UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                      throws ClassNotFoundException,
                                                             UnexecutableException,
                                                             InstantiationException

      Description copied from interface: `ParameterResolver`
      Returns a map mapping a parameter name to a value, exploring a given row of a `TableTest` to determine the valid parameters. Parameters that contain operations and/or references to variables will be resolved if the variable map is provided, but no type conversions will be done.
      Specified by:
        `createParameterMap` in interface `ParameterResolver`
      Parameters:
        `aTableTest` - the table test
        `aTableTestRow` - the row of the test
        `aResolveMethod` - specifies the kind of params to be resolved (null = `TableTestParameterResolveMethod.COMBINED`)
        `anIncludeArbitraryParametersFlag` - whether arbitrary parameters should be determined and included as well
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        a map with a String to value mapping
      Throws:
        `ClassNotFoundException`
        `UnexecutableException`
        `InstantiationException`

    - #### createParameterMap

          public Map<String,​Object> createParameterMap​(List<Parameter> someParameters,
                                                             boolean anIncludeArbitraryParametersFlag,
                                                             UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                      throws ClassNotFoundException,
                                                             UnexecutableException,
                                                             InstantiationException

      Description copied from interface: `ParameterResolver`
      Returns a map mapping a parameter name to a value, using a list of `Parameter` instances to determine the valid parameters. Parameters that contain operations or references to variables will be resolved if the variable map is provided, but no type conversions will be done.
      Specified by:
        `createParameterMap` in interface `ParameterResolver`
      Parameters:
        `someParameters` - the parameters
        `anIncludeArbitraryParametersFlag` - whether arbitrary parameters should be determined and included as well
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        a map with a String to value mapping
      Throws:
        `ClassNotFoundException`
        `UnexecutableException`
        `InstantiationException`

    - #### resolveParameterValue

          public Object resolveParameterValue​(ValueOrEnumValueOrOperationCollection aValueCollection,
                                              UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                       throws UnexecutableException,
                                              InstantiationException,
                                              ClassNotFoundException

      Description copied from interface: `ParameterResolver`
      Resolves the given `ValueOrEnumValueOrOperationCollection`, using the variable map given. Resolving only attempts to execute any operations and replace variable references with the current variable value, but does NOT convert the values to any other target type.
      Specified by:
        `resolveParameterValue` in interface `ParameterResolver`
      Parameters:
        `aValueCollection` - the value collection to resolve
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        the resolved value
      Throws:
        `UnexecutableException`
        `InstantiationException`
        `ClassNotFoundException`

    - #### resolveSingleParameterValue

          public Object resolveSingleParameterValue​(ValueOrEnumValueOrOperation aValue,
                                                    UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                             throws UnexecutableException,
                                                    InstantiationException,
                                                    ClassNotFoundException

      Description copied from interface: `ParameterResolver`
      Resolves the given `ValueOrEnumValueOrOperation`, using the variable map given. Resolving only attempts to execute any operations and replace variable references with the current variable value, but does NOT convert the values to any other target type.
      Specified by:
        `resolveSingleParameterValue` in interface `ParameterResolver`
      Parameters:
        `aValue` - the value to resolve
        `anUnresolvableVariableHandlingPolicy` - Defines the policy how unresolvable variable references (no variable given or no `VariableManager` available) shall be treated
      Returns:
        the resolved value
      Throws:
        `UnexecutableException`
        `InstantiationException`
        `ClassNotFoundException`

    - #### resolveStatically

          public Object resolveStatically​(Variable aVariable,
                                          VariantDefinition aVariant)
                                   throws ClassNotFoundException,
                                          InstantiationException,
                                          UnexecutableException

      Description copied from interface: `ParameterResolver`
      Resolves a variable (recursively, if necessary) to its actual value. Since this static method doesn't have access to the actual variable store of a test runner instance, the resolving can only be successful in cases of variables with initial value (giving that value) or constants.
      Specified by:
        `resolveStatically` in interface `ParameterResolver`
      Parameters:
        `aVariable` - the variable to resolve
        `aVariant` - the active variant
      Returns:
        the result, or null if none was found
      Throws:
        `ClassNotFoundException`
        `InstantiationException`
        `UnexecutableException`

    - #### resolveStatically

          public Object resolveStatically​(VariableOrConstantEntity anEntity,
                                          VariantDefinition aVariant)
                                   throws ClassNotFoundException,
                                          InstantiationException,
                                          UnexecutableException

      Description copied from interface: `ParameterResolver`
      Resolves a variable (recursively, if necessary) to its actual value. Since this static method doesn't have access to the actual variable store of a test runner instance, the resolving can only be successful in cases of variables with initial value (giving that value) or constants.
      Specified by:
        `resolveStatically` in interface `ParameterResolver`
      Parameters:
        `anEntity` - the entity to resolve
        `aVariant` - the active variant
      Returns:
        the result, or null if none was found
      Throws:
        `ClassNotFoundException`
        `InstantiationException`
        `UnexecutableException`

    - #### resolveStatically

          public Object resolveStatically​(ValueOrEnumValueOrOperation aValue,
                                          VariantDefinition aVariant)
                                   throws UnexecutableException,
                                          ClassNotFoundException,
                                          InstantiationException

      Description copied from interface: `ParameterResolver`
      Resolves a `ValueOrEnumValueOrOperation` to its actual value statically, that is, not requiring a current test execution context.
      Specified by:
        `resolveStatically` in interface `ParameterResolver`
      Parameters:
        `aValue` - the entity to resolve
        `aVariant` - the variant in use
      Returns:
        the result value
      Throws:
        `UnexecutableException`
        `ClassNotFoundException`
        `InstantiationException`

    - #### resolveStatically

          public Object resolveStatically​(ValueOrEnumValueOrOperationCollection aValue,
                                          VariantDefinition aVariant)
                                   throws UnexecutableException,
                                          ClassNotFoundException,
                                          InstantiationException

      Description copied from interface: `ParameterResolver`
      Resolves a `ValueOrEnumValueOrOperationCollection` to its actual value statically, that is, not requiring a current test execution context.
      Specified by:
        `resolveStatically` in interface `ParameterResolver`
      Parameters:
        `aValue` - the entity to resolve
        `aVariant` - the variant in use
      Returns:
        the result value
      Throws:
        `UnexecutableException`
        `ClassNotFoundException`
        `InstantiationException`

    - #### isSafelyStaticallyResolvable

          public boolean isSafelyStaticallyResolvable​(ValueOrEnumValueOrOperationCollection aValue,
                                                      VariantDefinition aVariant)

      Description copied from interface: `ParameterResolver`
      Determines whether the given `ValueOrEnumValueOrOperationCollection` is safely resolvable to a value in a static way, that is, not requiring a current execution context. "Safely" means that the resolved value is guaranteed not to change during runtime.
      Specified by:
        `isSafelyStaticallyResolvable` in interface `ParameterResolver`
      Parameters:
        `aValue` - the value to test
        `aVariant` - the variant to assume
      Returns:
        true if the value is safely resolvable, false otherwise

    - #### isSafelyStaticallyResolvable

          public boolean isSafelyStaticallyResolvable​(ValueOrEnumValueOrOperation aValue,
                                                      VariantDefinition aVariant)

      Description copied from interface: `ParameterResolver`
      Determines whether the given `ValueOrEnumValueOrOperation` is safely resolvable to a value in a static way, that is, not requiring a current execution context. "Safely" means that the resolved value is guaranteed not to change during runtime.
      Specified by:
        `isSafelyStaticallyResolvable` in interface `ParameterResolver`
      Parameters:
        `aValue` - the value to test
        `aVariant` - the variant to assume
      Returns:
        true if the value is safely resolvable, false otherwise

    - #### resolveStatically

          public Object resolveStatically​(ConstantDefinition aConstant,
                                          VariantDefinition aVariant)
                                   throws UnexecutableException,
                                          ClassNotFoundException,
                                          InstantiationException

      Description copied from interface: `ParameterResolver`
      Resolves a constant definition to its defined value, which may depend on the active variant.
      Specified by:
        `resolveStatically` in interface `ParameterResolver`
      Parameters:
        `aConstant` - the constant to resolve
        `aVariant` - the active variant
      Returns:
        the result, or null if none is defined for the constant
      Throws:
        `UnexecutableException`
        `ClassNotFoundException`
        `InstantiationException`

    - #### createExpectedResultMap

          public Map<String,​Object> createExpectedResultMap​(Test aTest,
                                                                  boolean anIncludeArbitraryResultFlag)

      Description copied from interface: `ParameterResolver`
      Returns a map of named results as expected by the given `Test`. The Map will connect result names to actual values. Does not support variable resolving!
      Specified by:
        `createExpectedResultMap` in interface `ParameterResolver`
      Parameters:
        `aTest` - the test
        `anIncludeArbitraryResultFlag` - whether arbitrary results shall be included
      Returns:
        a map of Strings to values