Merge pull request #656 from bjurga/bjurga-App.java-patch
Use UserConverter instead of rewriting its ctor
This commit is contained in:
commit
5ed46c2c64
@ -41,10 +41,7 @@ public class App {
|
|||||||
* @param args command line args
|
* @param args command line args
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Converter<UserDto, User> userConverter = new Converter<>(
|
Converter<UserDto, User> userConverter = new UserConverter();
|
||||||
userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(),
|
|
||||||
userDto.getEmail()),
|
|
||||||
user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), user.getUserId()));
|
|
||||||
|
|
||||||
UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com");
|
UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com");
|
||||||
User user = userConverter.convertFromDto(dtoUser);
|
User user = userConverter.convertFromDto(dtoUser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user