From 6b19bc7183d95fbb7c1bf827a13f412e9af3ad97 Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Tue, 10 Nov 2015 17:42:08 +0100 Subject: [PATCH 1/2] 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 13747339b..57599cd48 100644 --- a/src/main/java/com/github/dockerjava/api/model/Statistics.java +++ b/src/main/java/com/github/dockerjava/api/model/Statistics.java @@ -19,6 +19,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; @@ -31,6 +38,10 @@ public class Statistics { @JsonProperty("cpu_stats") private Map cpuStats; + public Map getNetworksStats() { + return networksStats; + } + public Map getNetworkStats() { return networkStats; } From 6ceb3cf9f70ff07294442cee38ff3bd42fc0933e Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Tue, 10 Nov 2015 18:01:35 +0100 Subject: [PATCH 2/2] Improve JavaDoc and include @CheckForNull --- .../dockerjava/api/model/Statistics.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 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 57599cd48..62aea8a05 100644 --- a/src/main/java/com/github/dockerjava/api/model/Statistics.java +++ b/src/main/java/com/github/dockerjava/api/model/Statistics.java @@ -2,12 +2,14 @@ import java.util.Map; +import javax.annotation.CheckForNull; + import org.apache.commons.lang.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; /** * Representation of a Docker statistics. @@ -19,11 +21,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") @@ -38,10 +44,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; }