web/play-java-forms/src/main/java/play/data/Form.java
@SuppressWarnings("unchecked")
  public Form<T> bind(
      Lang lang,
      TypedMap attrs,
      Map<String, String> data,
      Map<String, Http.MultipartFormData.FilePart<?>> files,
      String... allowedFields) {

    final DataBinder dataBinder = dataBinder(allowedFields);
    final Map<String, Object> objectDataFinal = getObjectData(data, files);

    final Set<ConstraintViolation<Object>> validationErrors =
        runValidation(lang, attrs, dataBinder, objectDataFinal);
    final BindingResult result = dataBinder.getBindingResult();

    validationErrors.forEach(violation -> addConstraintViolationToBindingResult(violation, result));

    boolean hasAnyError = result.hasErrors() || result.getGlobalErrorCount() > 0;

    if (hasAnyError) {
      final List<ValidationError> errors = getFieldErrorsAsValidationErrors(lang, result);
      final List<ValidationError> globalErrors = globalErrorsAsValidationErrors(result);

      errors.addAll(globalErrors);

      return new Form<>(
          rootName,
          backedType,
          data,
          files,
          errors,
          Optional.ofNullable((T) result.getTarget()),
          groups,
          messagesApi,
          formatters,
          this.validatorFactory,
          config,
          lang,
          directFieldAccess);
    }
    return new Form<>(
        rootName,
        backedType,
        data,
        files,
        errors,
        Optional.ofNullable((T) result.getTarget()),
        groups,
        messagesApi,
        formatters,
        this.validatorFactory,
        config,
        lang,
        directFieldAccess);
  }
@SuppressWarnings("unchecked")
  public Form<T> bind(
      Lang lang,
      TypedMap attrs,
      Map<String, String> data,
      Map<String, Http.MultipartFormData.FilePart<?>> files,
      String... allowedFields) {

    final DataBinder dataBinder = dataBinder(allowedFields);
    final Map<String, Object> objectDataFinal = getObjectData(data, files);

    final Set<ConstraintViolation<Object>> validationErrors =
        runValidation(lang, attrs, dataBinder, objectDataFinal);
    final BindingResult result = dataBinder.getBindingResult();

    validationErrors.forEach(violation -> addConstraintViolationToBindingResult(violation, result));

    boolean hasAnyError = result.hasErrors() || result.getGlobalErrorCount() > 0;

    if (hasAnyError) {
      final List<ValidationError> errors = getFieldErrorsAsValidationErrors(lang, result);
      final List<ValidationError> globalErrors = globalErrorsAsValidationErrors(result);

      errors.addAll(globalErrors);

      return new Form<>(
          rootName,
          backedType,
          data,
          files,
          errors,
          Optional.ofNullable((T) result.getTarget()),
          groups,
          messagesApi,
          formatters,
          this.validatorFactory,
          config,
          lang,
          directFieldAccess);
    }
    return new Form<>(
        rootName,
        backedType,
        data,
        files,
        errors,
        Optional.ofNullable((T) result.getTarget()),
        groups,
        messagesApi,
        formatters,
        this.validatorFactory,
        config,
        lang,
        directFieldAccess);
  }
Binds data to this form - that is, handles form submission.

@param lang used for validators and formatters during binding and is part of {@link
ValidationPayload}. Later also used for formatting when retrieving a field (via {@link
#field(String)} or {@link #apply(String)}) and for translations in {@link #errorsAsJson()}.
For these methods the lang can be change via {@link #withLang(Lang)}.
@param attrs will be passed to validators via {@link ValidationPayload}
@param data data to submit
@param allowedFields the fields that should be bound to the form, all fields if not specified.
@return a copy of this form filled with the new data