/*
   * (non-Javadoc)
   * @see org.springframework.data.mapping.model.ParameterValueProvider#getParameterValue(org.springframework.data.mapping.PreferredConstructor.Parameter)
   */
  @SuppressWarnings("unchecked")
  public <T> T getParameterValue(Parameter<T, P> parameter) {

    PreferredConstructor<?, P> constructor = entity.getPersistenceConstructor();

    if (constructor.isEnclosingClassParameter(parameter)) {
      return (T) parent;
    }

    P property = entity.getPersistentProperty(parameter.getName());

    if (property == null) {
      throw new MappingException(
          String.format(
              "No property %s found on entity %s to bind constructor parameter to!",
              parameter.getName(), entity.getType()));
    }

    return provider.getPropertyValue(property);
  }
 /*
  * (non-Javadoc)
  * @see org.springframework.data.mapping.model.SpELExpressionParameterValueProvider#potentiallyConvertSpelValue(java.lang.Object, org.springframework.data.mapping.PreferredConstructor.Parameter)
  */
 @Override
 protected <T> T potentiallyConvertSpelValue(
     Object object, Parameter<T, MongoPersistentProperty> parameter) {
   return readValue(object, parameter.getType(), path);
 }