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

org.zapodot.jackson.java8.JavaOptionalDeserializers Maven / Gradle / Ivy

Go to download

Jackson Databind module for serializing and deserializing Java 8 java.util.Option objects. This tool is forked from original source created by @realjenius

There is a newer version: 2.6.1
Show newest version
package org.zapodot.jackson.java8;

import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.Deserializers;

import java.util.Optional;

/**
 * @author R.J. Lorimer [[email protected]]
 */
public class JavaOptionalDeserializers extends Deserializers.Base {

    @Override
    public JsonDeserializer findBeanDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException {
        Class raw = type.getRawClass();
        if(Optional.class.isAssignableFrom(raw)){
            return new JavaOptionalDeserializer(type);
        }
        return super.findBeanDeserializer(type, config, beanDesc);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy