ifs-web-service/ifs-web-core/src/main/java/org/innovateuk/ifs/controller/ErrorToObjectErrorConverterFactory.java
/**
     * Manually map a field {@link Error} to a {@link FieldError}.
     *
     * @param mappingFunction returning the desired {@link FieldError}.
     * @return converter function between {@link Error} and {@link FieldError}.
     */
Manually map a field  Error to a  FieldError.
@param mappingFunction returning the desired  FieldError.
@return converter function between  Error and  FieldError.
Manually map a field Error to a FieldError . @param mappingFunction returning the desired FieldError . @return converter function between Error and FieldError .
public static ErrorToObjectErrorConverter fieldErrorsToFieldErrors(Function<Error, FieldError> mappingFunction) {
        return e -> {
            if (e.isFieldError()) {
                return Optional.of(mappingFunction.apply(e));
            }
            return Optional.empty();
        };
    }
public static ErrorToObjectErrorConverter fieldErrorsToFieldErrors ( Function < Error , FieldError > mappingFunction ) { return e -> { if ( e . isFieldError ( ) ) { return Optional . of ( mappingFunction . apply ( e ) ) ; } return Optional . empty ( ) ; } ; }
Manually map a field {@link Error} to a {@link FieldError}.
Manually map a field { @link Error } to a { @link FieldError } .