class TargetTypeCalculationParameter implements CalculationParameter, ImmutableBean, Serializable {

  public static TargetTypeCalculationParameter of(
      Map<Class<?>, CalculationParameter> parameters,
      CalculationParameter defaultParameter) {

    ArgChecker.notEmpty(parameters, "values");
    ArgChecker.notNull(defaultParameter, "defaultValue");
    Class<? extends CalculationParameter> queryType = defaultParameter.queryType();
    for (CalculationParameter value : parameters.values()) {
      if (value.queryType() != queryType) {
        throw new IllegalArgumentException(Messages.format(
            "Map contained a parameter '{}' that did not match the expected query type '{}'",
            value,
            queryType.getClass().getSimpleName()));
      }
    }
    return new TargetTypeCalculationParameter(queryType, ImmutableMap.copyOf(parameters), defaultParameter);
  }

  private  TargetTypeCalculationParameter(
      Class<? extends CalculationParameter> queryType,
      Map<Class<?>, CalculationParameter> parameters,
      CalculationParameter defaultParameter);

}