ifs-web-service/ifs-web-core/src/main/java/org/innovateuk/ifs/controller/ErrorToObjectErrorConverterFactory.java
/**
     * Given any error, map it to a target field name on the error holder.
     *
     * @param mappingFunction returning the target field name. If empty,
     *                        no {@link FieldError} will be added to the error holder.
     * @return converter function between {@link Error} and {@link FieldError}.
     */
Given any error, map it to a target field name on the error holder.
@param mappingFunction returning the target field name. If empty,
no  FieldError will be added to the error holder.
@return converter function between  Error and  FieldError.
Given any error map it to a target field name on the error holder . @param mappingFunction returning the target field name . If empty no FieldError will be added to the error holder . @return converter function between Error and FieldError .
public static ErrorToObjectErrorConverter mappingErrorToField(Function<Error, String> mappingFunction) {
        return e -> {
            String targetField = mappingFunction.apply(e);
            if (targetField == null || targetField.isEmpty()) {
                return Optional.empty();
            }
            return Optional.of(newFieldError(e, targetField, e.getFieldRejectedValue()));
        };
    }
public static ErrorToObjectErrorConverter mappingErrorToField ( Function < Error , String > mappingFunction ) { return e -> { String targetField = mappingFunction . apply ( e ) ; if ( targetField == null || targetField . isEmpty ( ) ) { return Optional . empty ( ) ; } return Optional . of ( newFieldError ( e , targetField , e . getFieldRejectedValue ( ) ) ) ; } ; }
Given any error, map it to a target field name on the error holder.
Given any error map it to a target field name on the error holder .