Skip to content

[update] nullable 필드에 Optional API 적용#5

Merged
snowykte0426 merged 2 commits intomainfrom
feat/optional-model
Mar 9, 2026
Merged

[update] nullable 필드에 Optional API 적용#5
snowykte0426 merged 2 commits intomainfrom
feat/optional-model

Conversation

@snowykte0426
Copy link
Member

Description

서버 DTO 분석을 통해 실제로 null이 반환될 수 있는 필드들을 파악하고, 해당 getter에 Java Optional API를 적용하였습니다.
SDK 사용자가 NPE 없이 안전하게 nullable 필드를 처리할 수 있도록 개선합니다.

Changes

  • ClubDetail.getLeader()Optional<ParticipantInfo> 반환으로 변경 (서버 PR #220 대응)
  • ParticipantInfo.getStudentNumber(), getMajor()Optional 적용
  • Meal.getMealAllergyInfo(), getMealCalories(), getOriginInfo(), getNutritionInfo(), getMealServeCount()Optional 적용
  • Schedule.getEventContent(), getDayCategory(), getSchoolCourseType(), getDayNightType()Optional 적용
  • Student.getGrade(), getClassNum(), getNumber(), getStudentNumber(), getMajor(), getDormitoryFloor(), getDormitoryRoom(), getMajorClub(), getJobClub(), getAutonomousClub()Optional 적용
  • Project.getClub()Optional<Club> 적용

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Test update

Checklist

  • 코드가 정상적으로 빌드됩니다

  • 관련 테스트를 추가하거나 업데이트했습니다

  • 문서를 업데이트했습니다 (필요한 경우)

  • Breaking change가 있다면 마이그레이션 가이드를 작성했습니다

    마이그레이션: getter 반환 타입이 Optional<T>로 변경되었으므로, 기존에 직접 반환값을 사용하던 코드는 .orElse(), .ifPresent() 등으로 수정이 필요합니다.

    // before
    Integer grade = student.getGrade();
    
    // after
    Integer grade = student.getGrade().orElse(null);
    // 또는
    student.getGrade().ifPresent(g -> System.out.println(g));

Related Issues

@snowykte0426 snowykte0426 merged commit 2f08379 into main Mar 9, 2026
1 check passed
@snowykte0426 snowykte0426 deleted the feat/optional-model branch March 10, 2026 08:36
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.

2 participants