All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy