Skip to content

Commit

Permalink
Merge pull request #577 from microsoft/periodAndDurationConstructor
Browse files Browse the repository at this point in the history
Adds periodAndDuration constructor using a periodAndDuration value.
  • Loading branch information
ramsessanchez authored Aug 21, 2023
2 parents 0886948 + f708aa5 commit c62a622
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

## [0.7.1] - 2023-08-21

### Changed

- Add PeriodAndDuration constructor to create new object from a PeriodAndDuration object.

## [0.7.0] - 2023-08-18

### Added
Expand Down
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 @@ -14,7 +14,7 @@ public UserAgentHandlerOption() { }
@Nonnull
private String productName = "kiota-java";
@Nonnull
private String productVersion = "0.7.0";
private String productVersion = "0.7.1";
/**
* Gets the product name to be used in the user agent header
* @return the product name
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ org.gradle.caching=true
mavenGroupId = com.microsoft.kiota
mavenMajorVersion = 0
mavenMinorVersion = 7
mavenPatchVersion = 0
mavenPatchVersion = 1
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down

0 comments on commit c62a622

Please sign in to comment.