Created
February 6, 2021 04:14
-
-
Save KalpaD/ed8a89ecd50c3b36c3920ab40d5fbf3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FormattedNameResponseMapper { | |
| private FormattedNameResponseMapper() { | |
| } | |
| public static FormattedNameResponse fromWebExchangeBindException(WebExchangeBindException ex) { | |
| FormattedNameResponse res = new FormattedNameResponse(); | |
| List<Error> errors = ex.getFieldErrors().stream() | |
| .map(fieldError -> new Error(fieldError.getField(), fieldError.getDefaultMessage())) | |
| .collect(Collectors.toList()); | |
| res.setErrors(errors); | |
| return res; | |
| } | |
| public static FormattedNameResponse fromFormatNameRequest(FormatNameRequest req) { | |
| String s = String.format("%s %s %s %s", req.getTitle(), req.getFirstName(), req.getMiddleName(), req.getLastName()); | |
| FormattedNameResponse res = new FormattedNameResponse(); | |
| res.setFormattedName(s); | |
| return res; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment