[DEV] remove use of record, pb with java 16

This commit is contained in:
Edouard DUPIN 2021-06-22 07:52:30 +02:00
parent 74e0a8dff2
commit 08bf01ae27
2 changed files with 27 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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 + " }");
}