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

de.sstoehr.harreader.jackson.ExceptionIgnoringIntegerDeserializer Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package de.sstoehr.harreader.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers;

import java.io.IOException;

public class ExceptionIgnoringIntegerDeserializer extends JsonDeserializer {
    @Override
    public Integer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
        try {
            NumberDeserializers.IntegerDeserializer integerDeserializer = new NumberDeserializers.IntegerDeserializer(Integer.class, null);
            return integerDeserializer.deserialize(jp, ctxt);
        } catch (IOException e) {
            //ignore
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy