mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.5.x'
Closes gh-48109
This commit is contained in:
+7
-9
@@ -19,8 +19,10 @@ package org.springframework.boot.buildpack.platform.docker;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import tools.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Image;
|
||||
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -108,19 +110,15 @@ public class ImagePlatform {
|
||||
* @return the JSON string
|
||||
*/
|
||||
public String toJson() {
|
||||
StringBuilder json = new StringBuilder("{");
|
||||
json.append(jsonPair("os", this.os));
|
||||
ObjectNode json = SharedJsonMapper.get().createObjectNode();
|
||||
json.put("os", this.os);
|
||||
if (StringUtils.hasText(this.architecture)) {
|
||||
json.append(",").append(jsonPair("architecture", this.architecture));
|
||||
json.put("architecture", this.architecture);
|
||||
}
|
||||
if (StringUtils.hasText(this.variant)) {
|
||||
json.append(",").append(jsonPair("variant", this.variant));
|
||||
json.put("variant", this.variant);
|
||||
}
|
||||
return json.append("}").toString();
|
||||
}
|
||||
|
||||
private String jsonPair(String name, String value) {
|
||||
return "\"%s\":\"%s\"".formatted(name, value);
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user