diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-03-02 10:52:47 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-03-02 10:52:47 +0100 |
commit | 2c4e77e0028b2409e9dc4a2adee1ad4b167fd6eb (patch) | |
tree | 2a52e9dc198a16f623e971eca75cdd42276d4dc8 /controller-server | |
parent | 89e0a09fcd7c156d236951765dbe0b10f4fbf14a (diff) |
Shorten reason with application changes
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java index 603f16a9ef6..59cf5adb6e2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java @@ -7,6 +7,7 @@ import com.yahoo.config.application.api.DeploymentSpec; import java.time.Instant; import java.util.Objects; import java.util.Optional; +import java.util.StringJoiner; /** * The changes to an application we currently wish to complete deploying. @@ -79,15 +80,11 @@ public final class Change { @Override public String toString() { - String platformString = platform.map(v -> "upgrade to " + v).orElse(null); - String applicationString = application.map(v -> "application change to " + v).orElse(null); - if (platformString != null && applicationString != null) - return platformString + " and " + applicationString; - if (platformString != null) - return platformString; - if (applicationString != null) - return applicationString; - return "no change"; + StringJoiner changes = new StringJoiner(" and "); + platform.ifPresent(version -> changes.add("upgrade to " + version.toString())); + application.ifPresent(version -> changes.add("application change to " + version.id())); + changes.setEmptyValue("no change"); + return changes.toString(); } public static Change of(ApplicationVersion applicationVersion) { |