Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created February 9, 2022 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpmurilo/3e8ccddff78e2e0694d4152d743fd649 to your computer and use it in GitHub Desktop.
Save httpmurilo/3e8ccddff78e2e0694d4152d743fd649 to your computer and use it in GitHub Desktop.
Default DTO
package io.httpmurilo.sales.dto;
import io.httpmurilo.sales.entity.User;
public class UserDTO {
public UserDTO convertToUser(User user) {
UserDTO dto = new UserDTO();
dto.setName(user.getName());
dto.setAge(user.getAge());
dto.setEmail(user.getName());
return dto;
}
private String name;
private Integer age;
private String email;
//getters and setters
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment