-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : TransportType 관련 exception 추가 및 dto에서 String타입으로 변경
- Loading branch information
Showing
4 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
server/src/main/java/com/talkka/server/bookmark/dto/BookmarkDetailRespDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 20 additions & 1 deletion
21
server/src/main/java/com/talkka/server/bookmark/enums/TransportType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
package com.talkka.server.bookmark.enums; | ||
|
||
import com.talkka.server.bookmark.exception.enums.InvalidTransportTypeEnumException; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum TransportType { | ||
BUS, SUBWAY | ||
BUS("bus"), SUBWAY("subway"); | ||
|
||
private final String type; | ||
|
||
TransportType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public static TransportType valueOfEnumString(String enumValue) { | ||
try { | ||
return TransportType.valueOf(enumValue); | ||
} catch (IllegalArgumentException exception) { | ||
throw new InvalidTransportTypeEnumException(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...in/java/com/talkka/server/bookmark/exception/enums/InvalidTransportTypeEnumException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.talkka.server.bookmark.exception.enums; | ||
|
||
import com.talkka.server.common.exception.InvalidTypeException; | ||
|
||
public class InvalidTransportTypeEnumException extends InvalidTypeException { | ||
private static final String MESSAGE = "잘못된 교통수단 구분입니다."; | ||
|
||
public InvalidTransportTypeEnumException() { | ||
super(MESSAGE); | ||
} | ||
} |