From dfa1e89da70e725d317eff763e119f717f955b08 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:38:56 -0700 Subject: [PATCH 1/2] adds periodAndDuration constructor using a periodAndDuration value. --- .../com/microsoft/kiota/PeriodAndDuration.java | 15 ++++++++++----- .../kiota/serialization/mocks/TestEntity.java | 2 +- .../kiota/serialization/mocks/TestEntity.java | 2 +- .../kiota/serialization/mocks/TestEntity.java | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/abstractions/src/main/java/com/microsoft/kiota/PeriodAndDuration.java b/components/abstractions/src/main/java/com/microsoft/kiota/PeriodAndDuration.java index 00d76e322..3ca43d921 100644 --- a/components/abstractions/src/main/java/com/microsoft/kiota/PeriodAndDuration.java +++ b/components/abstractions/src/main/java/com/microsoft/kiota/PeriodAndDuration.java @@ -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 @@ -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 @@ -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 @@ -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 @@ -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} diff --git a/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java b/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java index bea48bd3e..e8f39bd4a 100644 --- a/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java +++ b/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java @@ -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; diff --git a/components/serialization/json/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java b/components/serialization/json/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java index e3397964e..d11c228d8 100644 --- a/components/serialization/json/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java +++ b/components/serialization/json/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java @@ -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; diff --git a/components/serialization/multipart/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java b/components/serialization/multipart/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java index bea48bd3e..e8f39bd4a 100644 --- a/components/serialization/multipart/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java +++ b/components/serialization/multipart/src/test/java/com/microsoft/kiota/serialization/mocks/TestEntity.java @@ -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; From f708aa5ec8cb3c6efc91b3b9421d37e4ffb81fa4 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 18 Aug 2023 14:19:13 -0700 Subject: [PATCH 2/2] Bump to 0.7.1 and changelog --- CHANGELOG.md | 6 ++++++ .../http/middleware/options/UserAgentHandlerOption.java | 2 +- gradle.properties | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a04db00c2..5f9a3b747 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/options/UserAgentHandlerOption.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/options/UserAgentHandlerOption.java index c59fd07a3..3429ef364 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/options/UserAgentHandlerOption.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/options/UserAgentHandlerOption.java @@ -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 diff --git a/gradle.properties b/gradle.properties index ffbdc25e4..a5af70dcc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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