-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathUserResponse.java
More file actions
64 lines (53 loc) · 1.71 KB
/
UserResponse.java
File metadata and controls
64 lines (53 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.makefire.anonymous.rest.dto.response;
import com.makefire.anonymous.domain.user.entity.User;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
/**
* packageName : com.makefire.anonymous.rest.dto.response
* fileName : Response
* author : User
* date : 2022-01-15
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2022-01-15 User 최초 생성
*/
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class UserResponse {
private Long id; // id값
private String userId; //사용자 아이디
private String name; //이름
private String password; //패스워드
@Builder
public UserResponse(Long id, String userId, String name, String password){
this.id= id;
this.userId = userId;
this.name = name;
this.password = password;
}
public static UserResponse from(User user){
return UserResponse.builder()
.id(user.getId())
.userId(user.getUserId())
.name(user.getName())
.password(user.getPassword())
.build();
}
public static List<UserResponse> fromList(List<User> users){
List<UserResponse> userList = new ArrayList<>();
users.forEach(user -> userList.add(
UserResponse.builder()
.id(user.getId())
.userId(user.getUserId())
.name(user.getName())
.build()
));
return userList;
}
}