public ConstrainedElement build(ConstraintHelper constraintHelper) {
   if (member instanceof Field) {
     return new ConstrainedField(
         ConfigurationSource.API,
         ConstraintLocation.forProperty(member),
         getConstraints(constraintHelper),
         groupConversions,
         isCascading,
         isUnwrapValidatedValue());
   } else {
     return new ConstrainedExecutable(
         ConfigurationSource.API,
         ConstraintLocation.forProperty(member),
         getConstraints(constraintHelper),
         groupConversions,
         isCascading,
         isUnwrapValidatedValue());
   }
 }
 public ConstrainedParameter build(
     ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider) {
   // TODO HV-919 Support specification of type parameter constraints via XML and API
   return new ConstrainedParameter(
       ConfigurationSource.API,
       ConstraintLocation.forParameter(executableContext.getExecutable(), parameterIndex),
       ReflectionHelper.typeOf(executableContext.getExecutable(), parameterIndex),
       parameterIndex,
       executableContext
           .getExecutable()
           .getParameterNames(parameterNameProvider)
           .get(parameterIndex),
       getConstraints(constraintHelper),
       Collections.<MetaConstraint<?>>emptySet(),
       groupConversions,
       isCascading,
       unwrapMode());
 }
 public ConstrainedElement build(
     ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider) {
   // TODO HV-919 Support specification of type parameter constraints via XML and API
   return new ConstrainedExecutable(
       ConfigurationSource.API,
       ConstraintLocation.forReturnValue(executable),
       getParameters(constraintHelper, parameterNameProvider),
       crossParameterContext != null
           ? crossParameterContext.getConstraints(constraintHelper)
           : Collections.<MetaConstraint<?>>emptySet(),
       returnValueContext != null
           ? returnValueContext.getConstraints(constraintHelper)
           : Collections.<MetaConstraint<?>>emptySet(),
       Collections.<MetaConstraint<?>>emptySet(),
       returnValueContext != null
           ? returnValueContext.getGroupConversions()
           : Collections.<Class<?>, Class<?>>emptyMap(),
       returnValueContext != null ? returnValueContext.isCascading() : false,
       returnValueContext != null ? returnValueContext.unwrapMode() : UnwrapMode.AUTOMATIC);
 }
  private List<ConstrainedParameter> getParameters(
      ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider) {
    List<ConstrainedParameter> constrainedParameters = newArrayList();

    for (int i = 0; i < parameterContexts.length; i++) {
      ParameterConstraintMappingContextImpl parameter = parameterContexts[i];
      if (parameter != null) {
        constrainedParameters.add(parameter.build(constraintHelper, parameterNameProvider));
      } else {
        constrainedParameters.add(
            new ConstrainedParameter(
                ConfigurationSource.API,
                ConstraintLocation.forParameter(executable, i),
                ReflectionHelper.typeOf(executable, i),
                i,
                executable.getParameterNames(parameterNameProvider).get(i)));
      }
    }

    return constrainedParameters;
  }