-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLunch.java
More file actions
30 lines (26 loc) · 896 Bytes
/
Lunch.java
File metadata and controls
30 lines (26 loc) · 896 Bytes
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
package life.mosu.mosuserver.domain.application.entity;
import java.util.Arrays;
import life.mosu.mosuserver.global.exception.CustomRuntimeException;
import life.mosu.mosuserver.global.exception.ErrorCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum Lunch {
NONE("도시락 X"),
OPTION1("도시락 A"),
OPTION2("도시락 B"),
OPTION3("비건 도시락"),
OPTION4("한식 도시락"),
OPTION5("양식 도시락"),
OPTION6("중식 도시락");
private final String lunchName;
public static Lunch from(String lunchName) {
return Arrays.stream(values())
.filter(e -> e.getLunchName().equals(lunchName))
.findFirst()
.orElseThrow(
() -> new CustomRuntimeException(ErrorCode.NOT_FOUND_LUNCH)
);
}
}