From 09cb972a4d7c82d4457e518e9ee1b1c618c87277 Mon Sep 17 00:00:00 2001 From: Sadiq Ahmed Killedar <125464939+Er-Sadiq@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:06:32 +0530 Subject: [PATCH 1/3] "Refactor to use getOrDefault method for default values #59" --- .../handler/compose/DockerComposeConfiguration.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java index d848bd2c5..5e2c72e28 100644 --- a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java +++ b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java @@ -7,12 +7,14 @@ public class DockerComposeConfiguration { private final String basedir; private final String composeFile; private final boolean ignoreBuild; + public DockerComposeConfiguration(Map config) { - basedir = config.containsKey("basedir") ? config.get("basedir") : "src/main/docker"; - composeFile = config.containsKey("composeFile") ? config.get("composeFile") : "docker-compose.yml"; - ignoreBuild = config.containsKey("ignoreBuild") ? Boolean.parseBoolean(config.get("ignoreBuilder")) : false; + basedir = config.getOrDefault("basedir", "src/main/docker"); + composeFile = config.getOrDefault("composeFile", "docker-compose.yml"); + ignoreBuild = Boolean.parseBoolean(config.getOrDefault("ignoreBuild", "false")); } + String getBasedir() { return basedir; } From 45ea1df1de885c5e20d295911475097a688c68f5 Mon Sep 17 00:00:00 2001 From: Sadiq Ahmed Killedar <125464939+Er-Sadiq@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:18:45 +0530 Subject: [PATCH 2/3] Refactor DockerComposeConfiguration to Use getOrDefault for Default Values and fixed the indentation --- .../config/handler/compose/DockerComposeConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java index 5e2c72e28..4ef4d918e 100644 --- a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java +++ b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java @@ -9,12 +9,12 @@ public class DockerComposeConfiguration { private final boolean ignoreBuild; public DockerComposeConfiguration(Map config) { + basedir = config.getOrDefault("basedir", "src/main/docker"); composeFile = config.getOrDefault("composeFile", "docker-compose.yml"); ignoreBuild = Boolean.parseBoolean(config.getOrDefault("ignoreBuild", "false")); } - String getBasedir() { return basedir; } From a33de4f1129744deecaa02306a13dc5987e11bdd Mon Sep 17 00:00:00 2001 From: Sadiq Ahmed Killedar <125464939+Er-Sadiq@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:23:16 +0530 Subject: [PATCH 3/3] Refactor DockerComposeConfiguration to Use getOrDefault for Default Values and fixed the indentation issue:#1814 --- .../config/handler/compose/DockerComposeConfiguration.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java index 4ef4d918e..f44c54ab8 100644 --- a/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java +++ b/src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfiguration.java @@ -8,8 +8,7 @@ public class DockerComposeConfiguration { private final String composeFile; private final boolean ignoreBuild; - public DockerComposeConfiguration(Map config) { - + public DockerComposeConfiguration(Map config) { basedir = config.getOrDefault("basedir", "src/main/docker"); composeFile = config.getOrDefault("composeFile", "docker-compose.yml"); ignoreBuild = Boolean.parseBoolean(config.getOrDefault("ignoreBuild", "false"));