Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds periodAndDuration constructor using a periodAndDuration value. #577

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public Period getPeriod() {
public Duration getDuration() {
return duration;
}

/**
* Non-public Constructor for PeriodAndDuration
* @param period The {@code Period} component of the aggregate type
Expand All @@ -72,7 +71,6 @@ private PeriodAndDuration(@Nonnull Period period, @Nonnull Duration duration) {
this.period = period;
this.duration = duration;
}

/**
* Creates an instance based on a period and duration.
* @param period the {@code Period}, not null
Expand All @@ -85,7 +83,6 @@ public static PeriodAndDuration of(@Nonnull Period period, @Nonnull Duration dur
Objects.requireNonNull(duration, "parameter duration cannot be null");
return new PeriodAndDuration(period, duration);
}

/**
* Creates an instance based on a period.
* @param period the {@code Period}, not null
Expand All @@ -96,7 +93,6 @@ public static PeriodAndDuration ofPeriod(@Nonnull Period period) {
Objects.requireNonNull(period, "parameter period cannot be null");
return new PeriodAndDuration(period, Duration.ZERO);
}

/**
* Creates an instance based on a duration.
* @param duration the {@code Duration}, not null
Expand All @@ -107,7 +103,16 @@ public static PeriodAndDuration ofDuration(@Nonnull Duration duration) {
Objects.requireNonNull(duration, "parameter duration cannot be null");
return new PeriodAndDuration(Period.ZERO, duration);
}

/**
* Creates an instance based on a PeriodAndDuration.
* @param periodAndDuration the {@code PeriodAndDuration}, not null
* @return the combined {@code PeriodAndDuration}, not null
*/
@Nonnull
public static PeriodAndDuration ofPeriodAndDuration(@Nonnull PeriodAndDuration periodAndDuration) {
Objects.requireNonNull(periodAndDuration, "parameter periodAndDuration cannot be null");
return new PeriodAndDuration(periodAndDuration.getPeriod(), periodAndDuration.getDuration());
}
/**
* @param stringValue the {@code String} parse from.
* @return parsed instance of {@code PeriodAndDuration}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public PeriodAndDuration getWorkDuration() {
}

public void setWorkDuration(PeriodAndDuration value) {
this._workDuration = PeriodAndDuration.of(value.getPeriod(), value.getDuration());
this._workDuration = PeriodAndDuration.ofPeriodAndDuration(value);
}

private LocalTime _startWorkTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PeriodAndDuration getWorkDuration() {
}

public void setWorkDuration(PeriodAndDuration value) {
this._workDuration = PeriodAndDuration.of(value.getPeriod(), value.getDuration());
this._workDuration = PeriodAndDuration.ofPeriodAndDuration(value);
}

private LocalTime _startWorkTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public PeriodAndDuration getWorkDuration() {
}

public void setWorkDuration(PeriodAndDuration value) {
this._workDuration = PeriodAndDuration.of(value.getPeriod(), value.getDuration());
this._workDuration = PeriodAndDuration.ofPeriodAndDuration(value);
}

private LocalTime _startWorkTime;
Expand Down
Loading