From 2bb96f319d0f465a5a69223e63e3a24bad9ecfc3 Mon Sep 17 00:00:00 2001 From: devholic22 Date: Tue, 13 Aug 2024 08:50:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B9=8C=EB=8D=94=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MemberSurveys 빌더 사용 제거 및 생성자 이용하도록 수정 (빌더 어노테이션은 유지) - MemberSurvey는 빌더 사용하도록 수정 --- .../survey/domain/membersurvey/MemberSurvey.java | 12 +++++------- .../survey/domain/membersurvey/MemberSurveys.java | 10 ++++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurvey.java b/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurvey.java index bf6bcf71..affaa492 100644 --- a/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurvey.java +++ b/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurvey.java @@ -33,13 +33,11 @@ public class MemberSurvey { @Column(nullable = false) private Integer answerNumber; - private MemberSurvey(final Long surveyId, final Long questionId, final Integer answerNumber) { - this.surveyId = surveyId; - this.questionId = questionId; - this.answerNumber = answerNumber; - } - public static MemberSurvey of(final Long surveyId, final Long questionId, final Integer answerNumber) { - return new MemberSurvey(surveyId, questionId, answerNumber); + return MemberSurvey.builder() + .surveyId(surveyId) + .questionId(questionId) + .answerNumber(answerNumber) + .build(); } } diff --git a/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurveys.java b/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurveys.java index 722adf6a..eff2c530 100644 --- a/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurveys.java +++ b/src/main/java/com/atwoz/survey/domain/membersurvey/MemberSurveys.java @@ -38,11 +38,13 @@ public class MemberSurveys { @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE}, orphanRemoval = true, fetch = FetchType.LAZY) private List memberSurveys = new ArrayList<>(); + private MemberSurveys(final Long memberId, final List memberSurveys) { + this.memberId = memberId; + this.memberSurveys = memberSurveys; + } + public static MemberSurveys createWithMemberId(final Long memberId) { - return MemberSurveys.builder() - .memberId(memberId) - .memberSurveys(new ArrayList<>()) - .build(); + return new MemberSurveys(memberId, new ArrayList<>()); } public void submitSurveys(final List requests) {