diff --git a/src/org/atriasoft/death/ArgChoice.java b/src/org/atriasoft/death/ArgChoice.java index a678c49..d805624 100644 --- a/src/org/atriasoft/death/ArgChoice.java +++ b/src/org/atriasoft/death/ArgChoice.java @@ -1,5 +1,24 @@ package org.atriasoft.death; -public record ArgChoice(String val, String description) { +public class ArgChoice { + private String val; + private String description; + + public ArgChoice(final String val, final String description) { + this.val = val; + this.description = description; + } + public String getVal() { + return this.val; + } + public void setVal(final String val) { + this.val = val; + } + public String getDescription() { + return this.description; + } + public void setDescription(final String description) { + this.description = description; + } } diff --git a/src/org/atriasoft/death/ArgDefine.java b/src/org/atriasoft/death/ArgDefine.java index 32fdb89..0f9cb71 100644 --- a/src/org/atriasoft/death/ArgDefine.java +++ b/src/org/atriasoft/death/ArgDefine.java @@ -43,6 +43,9 @@ public class ArgDefine implements ArgInterface { this.optionSmall = smallOption; this.optionBig = bigOption; this.list = list; + if (this.list == null) { + this.list = new ArrayList<>(); + } if (this.list.size()!=0) { this.haveParam = true; } else if (haveParam) { @@ -110,7 +113,7 @@ public class ArgDefine implements ArgInterface { return true; } for (ArgChoice elem : this.list){ - if (elem.val().equals(argument)){ + if (elem.getVal().equals(argument)){ return true; } } @@ -137,14 +140,14 @@ public class ArgDefine implements ArgInterface { if (!this.list.isEmpty()){ boolean hasDescriptiveElement = false; for (ArgChoice elem : this.list) { - if (!elem.description().isEmpty()) { + if (!elem.getDescription().isEmpty()) { hasDescriptiveElement = true; break; } } if (hasDescriptiveElement) { for (ArgChoice elem : this.list){ - Log.print(" " + elem.val() + " { " + elem.description()); + Log.print(" " + elem.getVal() + " : " + elem.getDescription()); } } else { String tmpElementPrint = ""; @@ -152,7 +155,7 @@ public class ArgDefine implements ArgInterface { if (!tmpElementPrint.isEmpty()) { tmpElementPrint += " / "; } - tmpElementPrint += elem.val(); + tmpElementPrint += elem.getVal(); } Log.print(" { " + tmpElementPrint + " }"); }