Skip to content

Commit

Permalink
[REFACTOR] 유지보수성 향상을 위해 update 메소드들 분리 #208
Browse files Browse the repository at this point in the history
  • Loading branch information
Zena0128 committed Sep 13, 2024
1 parent 09b53ba commit 846e324
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/main/java/com/sports/server/command/game/domain/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,45 @@ public void cancelScore(LineupPlayer scorer) {
scoredTeam.cancelScore();
}

public void update(String name, LocalDateTime startTime,
String videoId, String gameQuarter, GameState state, Round round) {
public void updateName(String name) {
if (StringUtils.hasText(name)) {
this.name = name;
}
}

public void updateStartTime(LocalDateTime startTime) {
this.startTime = startTime;
this.videoId = videoId;
if (StringUtils.hasText(name)) {
}

public void updateVideoId(String videoId) {
if (StringUtils.hasText(videoId)) {
this.videoId = videoId;
}
}

public void updateGameQuarter(String gameQuarter) {
if (StringUtils.hasText(gameQuarter)) {
this.gameQuarter = gameQuarter;
}
}

public void updateState(GameState state) {
this.state = state;
}

public void updateRound(Round round) {
this.round = round;
}

public void updateAll(Game updatedGame) {
updateName(updatedGame.name);
updateStartTime(updatedGame.startTime);
updateVideoId(updatedGame.videoId);
updateGameQuarter(updatedGame.gameQuarter);
updateState(updatedGame.state);
updateRound(updatedGame.round);
}

public Game(Sport sport, Member manager, League league, String name, LocalDateTime startTime,
String videoId, String gameQuarter, GameState state, Round round) {
this.sport = sport;
Expand Down

0 comments on commit 846e324

Please sign in to comment.