com.satori.mods.suite.ConnectorsConfigDeserializer Maven / Gradle / Ivy
package com.satori.mods.suite;
import java.io.*;
import java.util.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.type.*;
import com.fasterxml.jackson.databind.*;
public class ConnectorsConfigDeserializer extends JsonDeserializer>> {
@Override
public HashMap> deserialize(JsonParser jp, DeserializationContext ctx) throws IOException {
ObjectCodec oc = jp.getCodec();
if (jp.currentToken() == JsonToken.START_OBJECT) {
return oc.readValue(jp, new TypeReference>>() {
});
}
ArrayList val = oc.readValue(jp, new TypeReference>() {
});
if (val == null) {
return null;
}
HashMap> res = new HashMap<>();
res.put("default", val);
return res;
}
}