configurator works so far
This commit is contained in:
parent
0cf84f5419
commit
812a1b1b21
25 changed files with 424 additions and 124 deletions
|
|
@ -12,6 +12,7 @@ shared_deps = [
|
|||
artifact("net.kyori:adventure-text-minimessage"),
|
||||
artifact("org.jdbi:jdbi3-core"),
|
||||
artifact("org.mongodb:bson"),
|
||||
artifact("com.google.code.gson:gson"),
|
||||
]
|
||||
|
||||
java_library(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package de.kentoj.scrowlib.utils;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
/**
|
||||
* @param <V> type of data
|
||||
*/
|
||||
public interface Serializer<V> {
|
||||
|
||||
JsonElement serialize(V value);
|
||||
|
||||
V deserialize(JsonElement json);
|
||||
|
||||
default String toJson(V value) {
|
||||
return serialize(value).toString();
|
||||
}
|
||||
|
||||
default V fromJson(String json) {
|
||||
return deserialize(JsonParser.parseString(json));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue