Skip to content

Commit ce76277

Browse files
committed
Use getIfNull correctly
1 parent a35c1d0 commit ce76277

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/main/java/io/github/fvarrui/javapackager/maven/PackageMojo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public void execute() throws MojoExecutionException {
352352
.additionalModulePaths(additionalModulePaths)
353353
.additionalResources(additionalResources)
354354
.administratorRequired(administratorRequired)
355-
.arch(getIfNull(arch, Arch.getDefault()))
355+
.arch(getIfNull(arch, Arch::getDefault))
356356
.assetsDir(assetsDir)
357357
.bundleJre(bundleJre)
358358
.classpath(classpath)
@@ -404,11 +404,11 @@ public void execute() throws MojoExecutionException {
404404
} catch (Exception e) {
405405

406406
throw new MojoExecutionException(e.getMessage(), e);
407-
407+
408408
}
409409

410410

411411
}
412412

413-
413+
414414
}

src/main/java/io/github/fvarrui/javapackager/model/LinuxConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public String toString() {
9494
*/
9595
public void setDefaults(Packager packager) {
9696
this.setCategories((categories == null || categories.isEmpty()) ? Collections.singletonList("Utility") : categories);
97-
this.setInstallationPath(ObjectUtils.getIfNull(installationPath, "/opt"));
97+
this.setInstallationPath(ObjectUtils.getIfNull(installationPath, () -> "/opt"));
9898
}
9999

100100
}

src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,16 @@ public String toString() {
305305
* @param packager Packager
306306
*/
307307
public void setDefaults(Packager packager) {
308-
this.setWindowX(getIfNull(this.getWindowX(), 10));
309-
this.setWindowY(getIfNull(this.getWindowY(), 60));
310-
this.setWindowWidth(getIfNull(this.getWindowWidth(), 540));
311-
this.setWindowHeight(getIfNull(this.getWindowHeight(), 360));
312-
this.setIconSize(getIfNull(this.getIconSize(), 128));
313-
this.setTextSize(getIfNull(this.getTextSize(), 16));
314-
this.setIconX(getIfNull(this.getIconX(), 52));
315-
this.setIconY(getIfNull(this.getIconY(), 116));
316-
this.setAppsLinkIconX(getIfNull(this.getAppsLinkIconX(), 360));
317-
this.setAppsLinkIconY(getIfNull(this.getAppsLinkIconY(), 116));
318-
this.setAppId(getIfNull(this.getAppId(), packager.getMainClass()));
308+
this.setWindowX(getIfNull(this.getWindowX(), () -> 10));
309+
this.setWindowY(getIfNull(this.getWindowY(), () -> 60));
310+
this.setWindowWidth(getIfNull(this.getWindowWidth(), () -> 540));
311+
this.setWindowHeight(getIfNull(this.getWindowHeight(), () -> 360));
312+
this.setIconSize(getIfNull(this.getIconSize(), () -> 128));
313+
this.setTextSize(getIfNull(this.getTextSize(), () -> 16));
314+
this.setIconX(getIfNull(this.getIconX(), () -> 52));
315+
this.setIconY(getIfNull(this.getIconY(), () -> 116));
316+
this.setAppsLinkIconX(getIfNull(this.getAppsLinkIconX(), () -> 360));
317+
this.setAppsLinkIconY(getIfNull(this.getAppsLinkIconY(), () -> 116));
318+
this.setAppId(getIfNull(this.getAppId(), packager::getMainClass));
319319
}
320320
}

0 commit comments

Comments
 (0)