From 4312d22537af1b30b780d3eb60a1721cacb2f0e1 Mon Sep 17 00:00:00 2001 From: wonyongChoi05 Date: Thu, 23 Nov 2023 17:00:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20getPartByName=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/wooteco/prolog/member/domain/Part.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/main/java/wooteco/prolog/member/domain/Part.java b/backend/src/main/java/wooteco/prolog/member/domain/Part.java index bc65384eb..36cf9e6a1 100644 --- a/backend/src/main/java/wooteco/prolog/member/domain/Part.java +++ b/backend/src/main/java/wooteco/prolog/member/domain/Part.java @@ -23,4 +23,11 @@ public boolean isContainedBy(String name) { .anyMatch(p -> p.name.equals(name)); } + public static Part getPartByName(String name) { + return Arrays.stream(values()) + .filter(part -> part.name.equals(name)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException()); + } + }