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

de.aipark.api.webservice.jsonConverter.aiparkapi.SimpleKeyDeserializer Maven / Gradle / Ivy

package de.aipark.api.webservice.jsonConverter.aiparkapi;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

/**
 * Created by torgen on 25.09.17.
 */
public class SimpleKeyDeserializer extends KeyDeserializer {
    ObjectMapper objectMapper;
    private Class type;

    public SimpleKeyDeserializer() {
        objectMapper = new ObjectMapper();
    }
    @Override
    public T deserializeKey(String key, DeserializationContext ctxt) throws IOException, JsonProcessingException {

        try {
            return (T)objectMapper.readValue(key,type.getClass());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy