blob: e9a41dad53485528db3ce50ddf4f360a05849f46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package de.hype.bbsentials.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class CustomGson {
public static Gson create() {
return new GsonBuilder()
// .registerTypeHierarchyAdapter(BBDisplayNameProvider.class, new BBDisplayNameProviderSerializer())
.create();
}
// private static class BBDisplayNameProviderSerializer implements JsonSerializer<BBDisplayNameProvider>, JsonDeserializer<BBDisplayNameProvider> {
// @Override
// public JsonElement serialize(BBDisplayNameProvider src, Type typeOfSrc, JsonSerializationContext context) {
// return new JsonPrimitive(src.serialize()); // Serialize using the provided method
// }
//
// @Override
// public BBDisplayNameProvider deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
// String serializedValue = json.getAsString();
//
// // Deserialize using the provided method (you need to implement this)
// return BBDisplayNameProvider.deserialize(serializedValue);
// }
// }
}
|