Created toString and EnumUtils class to fix case dependent casting string to enum.
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package dev.micle.xptools.config;
|
||||
|
||||
import dev.micle.xptools.util.EnumUtils;
|
||||
|
||||
public class OperationItem {
|
||||
private boolean isTag;
|
||||
private String id;
|
||||
@ -16,7 +18,7 @@ public class OperationItem {
|
||||
isTag = splitString[0].startsWith("#");
|
||||
id = isTag ? splitString[0].substring(1) : splitString[0];
|
||||
|
||||
type = OperationType.valueOf(splitString[1]);
|
||||
type = EnumUtils.valueOf(OperationType.class, splitString[1]);
|
||||
|
||||
min = Float.parseFloat(splitString[2]);
|
||||
max = Float.parseFloat(splitString[3]);
|
||||
@ -27,6 +29,21 @@ public class OperationItem {
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (isTag) {
|
||||
builder.append("#");
|
||||
}
|
||||
builder
|
||||
.append(id).append(",")
|
||||
.append(type.toString()).append(",")
|
||||
.append(min).append(",").append(max).append(",")
|
||||
.append(priority).append(",")
|
||||
.append(isLast);
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public boolean isTag() {
|
||||
return isTag;
|
||||
}
|
||||
|
Reference in New Issue
Block a user