Interface ParameterResolver

  • All Known Implementing Classes:
    DefaultParameterResolver

    public interface ParameterResolver
    The parameter resolver is responsible for the creation of a map of parameters for fixture executions. It does NOT convert any values, which is the duty of the ValueConverter.
    Author:
    Rene Schneider - initial API and implementation
    • Method Detail

      • createParameterMap

        java.util.Map<java.lang.String,​java.lang.Object> createParameterMap​(Test aTest,
                                                                                  boolean anIncludeArbitraryParametersFlag,
                                                                                  UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                                           throws java.lang.ClassNotFoundException,
                                                                                  UnexecutableException,
                                                                                  java.lang.InstantiationException
        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.
        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:
        java.lang.InstantiationException
        UnexecutableException
        java.lang.ClassNotFoundException
      • createParameterMap

        java.util.Map<java.lang.String,​java.lang.Object> createParameterMap​(Call aCall,
                                                                                  boolean anIncludeArbitraryParametersFlag,
                                                                                  UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                                           throws java.lang.ClassNotFoundException,
                                                                                  UnexecutableException,
                                                                                  java.lang.InstantiationException
        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.
        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:
        java.lang.InstantiationException
        UnexecutableException
        java.lang.ClassNotFoundException
      • createParameterMap

        java.util.Map<java.lang.String,​java.lang.Object> createParameterMap​(TableTest aTableTest,
                                                                                  TableTestRow aTableTestRow,
                                                                                  TableTestParameterResolveMethod aResolveMethod,
                                                                                  boolean anIncludeArbitraryParametersFlag,
                                                                                  UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                                           throws java.lang.ClassNotFoundException,
                                                                                  UnexecutableException,
                                                                                  java.lang.InstantiationException
        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.
        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:
        java.lang.InstantiationException
        UnexecutableException
        java.lang.ClassNotFoundException
      • createParameterMap

        java.util.Map<java.lang.String,​java.lang.Object> createParameterMap​(java.util.List<Parameter> someParameters,
                                                                                  boolean anIncludeArbitraryParametersFlag,
                                                                                  UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                                                           throws java.lang.ClassNotFoundException,
                                                                                  UnexecutableException,
                                                                                  java.lang.InstantiationException
        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.
        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:
        java.lang.InstantiationException
        UnexecutableException
        java.lang.ClassNotFoundException
      • resolveParameterValue

        java.lang.Object resolveParameterValue​(ValueOrEnumValueOrOperationCollection aValueCollection,
                                               UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                        throws UnexecutableException,
                                               java.lang.InstantiationException,
                                               java.lang.ClassNotFoundException
        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.
        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
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
      • resolveSingleParameterValue

        java.lang.Object resolveSingleParameterValue​(ValueOrEnumValueOrOperation aValue,
                                                     UnresolvableVariableHandling anUnresolvableVariableHandlingPolicy)
                                              throws UnexecutableException,
                                                     java.lang.InstantiationException,
                                                     java.lang.ClassNotFoundException
        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.
        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
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
      • resolveStatically

        java.lang.Object resolveStatically​(Variable aVariable,
                                           VariantDefinition aVariant)
                                    throws java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException,
                                           UnexecutableException
        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.
        Parameters:
        aVariable - the variable to resolve
        aVariant - the active variant
        Returns:
        the result, or null if none was found
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        UnexecutableException
      • resolveStatically

        java.lang.Object resolveStatically​(VariableOrConstantEntity anEntity,
                                           VariantDefinition aVariant)
                                    throws java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException,
                                           UnexecutableException
        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.
        Parameters:
        anEntity - the entity to resolve
        aVariant - the active variant
        Returns:
        the result, or null if none was found
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        UnexecutableException
      • isSafelyStaticallyResolvable

        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. "Safely" means that the resolved value is guaranteed not to change during runtime.
        Parameters:
        aValue - the value to test
        aVariant - the variant to assume
        Returns:
        true if the value is safely resolvable, false otherwise
      • isSafelyStaticallyResolvable

        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. "Safely" means that the resolved value is guaranteed not to change during runtime.
        Parameters:
        aValue - the value to test
        aVariant - the variant to assume
        Returns:
        true if the value is safely resolvable, false otherwise
      • resolveStatically

        java.lang.Object resolveStatically​(ConstantDefinition aConstant,
                                           VariantDefinition aVariant)
                                    throws UnexecutableException,
                                           java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException
        Resolves a constant definition to its defined value, which may depend on the active variant.
        Parameters:
        aConstant - the constant to resolve
        aVariant - the active variant
        Returns:
        the result, or null if none is defined for the constant
        Throws:
        UnexecutableException
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
      • createExpectedResultMap

        java.util.Map<java.lang.String,​java.lang.Object> createExpectedResultMap​(Test aTest,
                                                                                       boolean anIncludeArbitraryResultFlag)
        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!
        Parameters:
        aTest - the test
        anIncludeArbitraryResultFlag - whether arbitrary results shall be included
        Returns:
        a map of Strings to values