Json serialization improved

This commit is contained in:
2026-03-20 20:39:29 +01:00
parent 61accce977
commit a5885e1828
9 changed files with 134 additions and 119 deletions
@@ -1,5 +1,8 @@
package org.saturnclient.config.property;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
public class StringProperty extends Property {
public String value;
public final String defaultValue;
@@ -8,4 +11,15 @@ public class StringProperty extends Property {
this.value = defaultValue;
this.defaultValue = defaultValue;
}
@Override
public JsonNode toJson() {
return JsonNodeFactory.instance.textNode(this.value);
}
@Override
public void loadFromJson(JsonNode element) {
if (element.isTextual())
this.value = element.textValue();
}
}