diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/JsonListEntrySerializer.java')
-rw-r--r-- | src/main/java/net/minecraft/server/JsonListEntrySerializer.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/JsonListEntrySerializer.java b/src/main/java/net/minecraft/server/JsonListEntrySerializer.java new file mode 100644 index 00000000..b6aba6a6 --- /dev/null +++ b/src/main/java/net/minecraft/server/JsonListEntrySerializer.java @@ -0,0 +1,49 @@ +package net.minecraft.server; + +import java.lang.reflect.Type; + +import net.minecraft.util.com.google.gson.JsonDeserializationContext; +import net.minecraft.util.com.google.gson.JsonDeserializer; +import net.minecraft.util.com.google.gson.JsonElement; +import net.minecraft.util.com.google.gson.JsonObject; +import net.minecraft.util.com.google.gson.JsonSerializationContext; +import net.minecraft.util.com.google.gson.JsonSerializer; + +class JsonListEntrySerializer implements JsonDeserializer, JsonSerializer { + + final JsonList a; + + private JsonListEntrySerializer(JsonList jsonlist) { + this.a = jsonlist; + } + + public JsonElement a(JsonListEntry jsonlistentry, Type type, JsonSerializationContext jsonserializationcontext) { + JsonObject jsonobject = new JsonObject(); + + jsonlistentry.a(jsonobject); + return jsonobject; + } + + public JsonListEntry a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) { + if (jsonelement.isJsonObject()) { + JsonObject jsonobject = jsonelement.getAsJsonObject(); + JsonListEntry jsonlistentry = this.a.a(jsonobject); + + return jsonlistentry; + } else { + return null; + } + } + + public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { + return this.a((JsonListEntry) object, type, jsonserializationcontext); + } + + public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) { + return this.a(jsonelement, type, jsondeserializationcontext); + } + + JsonListEntrySerializer(JsonList jsonlist, JsonListType jsonlisttype) { + this(jsonlist); + } +} |