From f8a5fb47fc6e7c724dca8b5d29b9a7cce557bb8e Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Tue, 10 Nov 2015 17:42:08 +0100 Subject: [PATCH 1/3] Deprecate "network" and enable "networks" stats (remote Docker API 1.21) --- .../com/github/dockerjava/api/model/Statistics.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/github/dockerjava/api/model/Statistics.java b/src/main/java/com/github/dockerjava/api/model/Statistics.java index f6acf16ee..4e2692014 100644 --- a/src/main/java/com/github/dockerjava/api/model/Statistics.java +++ b/src/main/java/com/github/dockerjava/api/model/Statistics.java @@ -16,6 +16,13 @@ public class Statistics { @JsonProperty("read") private String read; + @JsonProperty("networks") + private Map networksStats; + + /** + * Deprecated as of Docker Remote API 1.21 + */ + @Deprecated @JsonProperty("network") private Map networkStats; @@ -28,6 +35,10 @@ public class Statistics { @JsonProperty("cpu_stats") private Map cpuStats; + public Map getNetworksStats() { + return networksStats; + } + public Map getNetworkStats() { return networkStats; } From ef030277b81e42336747be435c2ee9050550a3ac Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Tue, 10 Nov 2015 18:01:35 +0100 Subject: [PATCH 2/3] Improve JavaDoc and include @CheckForNull Conflicts: src/main/java/com/github/dockerjava/api/model/Statistics.java --- .../github/dockerjava/api/model/Statistics.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/dockerjava/api/model/Statistics.java b/src/main/java/com/github/dockerjava/api/model/Statistics.java index 4e2692014..ec837a0ac 100644 --- a/src/main/java/com/github/dockerjava/api/model/Statistics.java +++ b/src/main/java/com/github/dockerjava/api/model/Statistics.java @@ -2,6 +2,8 @@ import java.util.Map; +import javax.annotation.CheckForNull; + import org.apache.commons.lang.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -16,11 +18,15 @@ public class Statistics { @JsonProperty("read") private String read; + /** + * @since Docker Remote API 1.21 + */ + @CheckForNull @JsonProperty("networks") private Map networksStats; /** - * Deprecated as of Docker Remote API 1.21 + * @deprecated as of Docker Remote API 1.21, replaced by {@link #networksStats} */ @Deprecated @JsonProperty("network") @@ -35,10 +41,18 @@ public class Statistics { @JsonProperty("cpu_stats") private Map cpuStats; + /** + * @since Docker Remote API 1.21 + */ + @CheckForNull public Map getNetworksStats() { return networksStats; } + /** + * @deprecated as of Docker Remote API 1.21, replaced by {@link #getNetworksStats()} + */ + @Deprecated public Map getNetworkStats() { return networkStats; } From ee1b8cf6beb7f49b7e246109b1bf6de8ea272fcf Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Wed, 11 Nov 2015 13:36:55 +0100 Subject: [PATCH 3/3] Remove "Stats" from "networks" field in statistics --- .../com/github/dockerjava/api/model/Statistics.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/dockerjava/api/model/Statistics.java b/src/main/java/com/github/dockerjava/api/model/Statistics.java index ec837a0ac..c4daf0573 100644 --- a/src/main/java/com/github/dockerjava/api/model/Statistics.java +++ b/src/main/java/com/github/dockerjava/api/model/Statistics.java @@ -23,10 +23,10 @@ public class Statistics { */ @CheckForNull @JsonProperty("networks") - private Map networksStats; + private Map networks; /** - * @deprecated as of Docker Remote API 1.21, replaced by {@link #networksStats} + * @deprecated as of Docker Remote API 1.21, replaced by {@link #networks} */ @Deprecated @JsonProperty("network") @@ -45,12 +45,12 @@ public class Statistics { * @since Docker Remote API 1.21 */ @CheckForNull - public Map getNetworksStats() { - return networksStats; + public Map getNetworks() { + return networks; } /** - * @deprecated as of Docker Remote API 1.21, replaced by {@link #getNetworksStats()} + * @deprecated as of Docker Remote API 1.21, replaced by {@link #getNetworks()} */ @Deprecated public Map getNetworkStats() {