package io.gitlab.jfronny.inceptum.launcher.gson; import gsoncompile.extensions.io.gitlab.jfronny.inceptum.launcher.system.source.ModSource.GC_ModSource; import io.gitlab.jfronny.gson.stream.JsonReader; import io.gitlab.jfronny.gson.stream.JsonWriter; import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta.Sources; import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource; import java.io.IOException; import java.util.Optional; public class ModMetaSourcesAdapter { public static void write(Sources value, JsonWriter writer) throws IOException { writer.beginArray(); for (ModSource source : value.keySet()) GC_ModSource.write(source, writer); writer.endArray(); } public static Sources read(JsonReader reader) throws IOException { reader.beginArray(); Sources sources = new Sources(); while (reader.hasNext()) { sources.put(GC_ModSource.read(reader), Optional.empty()); } reader.endArray(); return sources; } }