[REFACTOR/#122] @JsonCreator 도입을 통한 보일러플레이트 제거#123
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors enum deserialization by introducing the @JsonCreator annotation to reduce boilerplate code and improve type safety. The changes eliminate manual string-to-enum conversions by leveraging Jackson's automatic deserialization capabilities.
Key changes:
- Added
@JsonCreatorannotations to enumfromValue()methods for automatic JSON deserialization - Updated request DTOs to use enum types directly instead of strings
- Removed manual enum conversion calls throughout service and controller layers
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tag.java, SpotType.java, SpotStatus.java | Added @JsonCreator annotation to enable automatic enum deserialization |
| SocialType.java, Platform.java, ImageType.java, DislikeFood.java | Added @JsonCreator annotation to enable automatic enum deserialization |
| SpotListRequest.java, ApplySpotRequest.java | Changed field types from String to enum types with updated validation |
| PreferenceRequest.java, PreSignedUrlRequest.java, LoginRequest.java | Changed field types from String to enum types with updated validation |
| SpotService.java | Removed manual enum conversion calls, now using enum fields directly |
| MemberController.java, AdminController.java | Removed manual enum conversion and unused imports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| private static boolean isCafe(String value) { | ||
| return SpotType.CAFE.name().equalsIgnoreCase(value); | ||
| private static boolean isCafe(SpotType spotType) { | ||
| return SpotType.CAFE.name().equalsIgnoreCase(spotType.name()); |
There was a problem hiding this comment.
The method can be simplified by directly comparing enum values instead of comparing their string names. Replace with return SpotType.CAFE.equals(spotType); for better performance and readability.
Suggested change
| return SpotType.CAFE.name().equalsIgnoreCase(spotType.name()); | |
| return SpotType.CAFE.equals(spotType); |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Issue
📄 Description