org.zapodot.jackson.java8.JavaOptionalDeserializers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-databind-java-optional Show documentation
Show all versions of jackson-databind-java-optional Show documentation
Jackson Databind module for serializing and deserializing Java 8 java.util.Option objects.
This tool is forked from original source created by @realjenius
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);
}
}