Skip to content

Conversation

@ckkim817
Copy link
Member

💡 Issue

📄 Description

  • Enum 역직렬화 시 @JsonCreator를 도입해 보일러플레이트를 제거했습니다.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @JsonCreator annotations to enum fromValue() 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());
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copilot uses AI. Check for mistakes.
@ckkim817 ckkim817 merged commit 2764a1e into develop Sep 16, 2025
1 check passed
@ckkim817 ckkim817 deleted the refactor/#122 branch September 16, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] @JsonCreator 도입을 통한 보일러플레이트 제거

2 participants