io.vavr.gson.TraversableConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vavr-gson Show documentation
Show all versions of vavr-gson Show documentation
A set of GSON serialiser/deserialisers for Vavr.io
/* __ __ __ __ __ ___
* \ \ / / \ \ / / __/
* \ \/ / /\ \ \/ / /
* \____/__/ \__\____/__/.ɪᴏ
* ᶜᵒᵖʸʳᶦᵍʰᵗ ᵇʸ ᵛᵃᵛʳ ⁻ ˡᶦᶜᵉⁿˢᵉᵈ ᵘⁿᵈᵉʳ ᵗʰᵉ ᵃᵖᵃᶜʰᵉ ˡᶦᶜᵉⁿˢᵉ ᵛᵉʳˢᶦᵒⁿ ᵗʷᵒ ᵈᵒᵗ ᶻᵉʳᵒ
*/
package io.vavr.gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonParseException;
import io.vavr.collection.Stream;
import io.vavr.collection.Traversable;
import java.lang.reflect.Type;
import java.util.function.Function;
class TraversableConverter> extends JsonArrayConverter {
private final Function, Traversable>> factory;
TraversableConverter(Function, Traversable>> factory) {
this.factory = factory;
}
@Override
@SuppressWarnings("unchecked")
T fromJsonArray(JsonArray arr, Type type, Type[] subTypes, JsonDeserializationContext ctx) throws JsonParseException {
Stream