org.zapodot.jackson.java8.JavaOptionalModule 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.core.Version;
import com.fasterxml.jackson.databind.Module;
/**
* Module that installs Java 8 optional support into Jackson.
*
* This is very closely modeled after the support in jackson-datatype-guava for Optionals
*
* @author R.J. Lorimer [[email protected]]
*/
public class JavaOptionalModule extends Module {
@Override
public String getModuleName() {
return "java8";
}
@Override
public Version version() {
return new PackageVersion().version();
}
@Override
public void setupModule(SetupContext context) {
context.addDeserializers(new JavaOptionalDeserializers());
context.addSerializers(new JavaOptionalSerializers());
context.addBeanSerializerModifier(new JavaOptionalBeanSerializerModifier());
}
}