Skip to content

Commit

Permalink
refactor: 지역 코드 길이 상수 추출
Browse files Browse the repository at this point in the history
  • Loading branch information
1o18z committed Oct 3, 2023
1 parent c6e148f commit a8e12ce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import javax.persistence.Column
import javax.persistence.Embeddable
import javax.persistence.Embedded

private const val CITY_CODE_LENGTH = 10

@Embeddable
class ShopAddress private constructor(
@Column(name = "city_code", nullable = false)
Expand All @@ -22,7 +24,7 @@ class ShopAddress private constructor(
}

private fun checkIsCityCodeLength(cityCode: String) {
if (cityCode.length != 10) {
if (cityCode.length != CITY_CODE_LENGTH) {
throw IllegalArgumentException("올바른 지역 코드가 아닙니다. (행정동 지역 코드는 10자리)")
}
}
Expand Down

0 comments on commit a8e12ce

Please sign in to comment.