Skip to content

INTERNAL: Move create clause and overflow action validation out of CollectionCreate#1103

Merged
jhpark816 merged 1 commit into
naver:developfrom
f1v3-dev:internal/attributes
Jul 15, 2026
Merged

INTERNAL: Move create clause and overflow action validation out of CollectionCreate#1103
jhpark816 merged 1 commit into
naver:developfrom
f1v3-dev:internal/attributes

Conversation

@f1v3-dev

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

  • CollectionCreate 에 몰려 있던 책임을 각 클래스로 옮겨 응집도를 높이고 중복을 제거했습니다.
  • 내부 리팩토링으로 동작에는 변화가 없습니다.

AS-IS

  • CollectionCreate 가 정적 유틸(makeCreateClause, checkOverflowAction) 메서드를 가지고 있어, 남의 책임까지 가지고 있는 상황

TO-BE

  • 각 관심사를 소유자(CreateAttributes, CollectionType)에게 이동시키고, CollectionCreate 는 "명령을 어떻게 조립할 것인가" 만을 남기는 형태로 전환
    • CreateAttributes: 속성 직렬화 담당 (stringify, toCreateClause)
    • CollectionType: 자신의 타입이 허용할 수 있는 overflow action 검증 담당 (checkOverflowAction)
    • CollectionCreate: 명령 조립만 담당 (속성 부분은 CreateAttributes 에 위임)

@f1v3-dev
f1v3-dev requested a review from oliviarla July 15, 2026 06:21
@f1v3-dev f1v3-dev self-assigned this Jul 15, 2026
oliviarla
oliviarla previously approved these changes Jul 15, 2026
@oliviarla
oliviarla requested a review from jhpark816 July 15, 2026 07:36

@jhpark816 jhpark816 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

리뷰 완료

* @return {@code <exp> <maxcount> [overflow action] [unreadable]} (no flags / create / noreply)
*/
public String stringify() {
return clause;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

stringify() 메서드에 실제 string화하는 코드를 두는 것이 자연스럽지 않는 지 ?

  if (clause == null) {
    StringBuilder sb = new StringBuilder();
    sb.append(expireTime).append(' ').append(maxCount);
    if (overflowAction != null) {
      sb.append(' ').append(overflowAction);
    }
    if (!readable) {
      sb.append(' ').append("unreadable");
    }
    clause = sb.toString();
  }
  return clause;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

의미상 stringify() 에서 진행하는게 더 적합해보입니다.
수정하도록 하겠습니다.

Comment thread src/main/java/net/spy/memcached/collection/CollectionCreate.java
…ollectionCreate`

- Move create clause serialization to CreateAttributes
- Move overflow action validation to CollectionType
@jhpark816
jhpark816 merged commit 2dc80f9 into naver:develop Jul 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants