디자인 패턴에서, Builder를 사용할 것을 권장하고 있다.
@Builder
@Getter
@Entity
@NoArgsConstructor
public class Membmer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idx;
private String name;
private String email;
public Member(Long idx, String name, String email) {
this.idx = idx;
this.name = name;
this.email = email;
}
}
// 사용 방법
Member member = Member.builder()
.name("Jan")
.email("[email protected]")
.build();