de.sstoehr.harreader.jackson.DefaultMapperFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of har-reader Show documentation
Show all versions of har-reader Show documentation
A library to access HTTP archive format with Java
package de.sstoehr.harreader.jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import de.sstoehr.harreader.HarReaderMode;
import java.util.Date;
public class DefaultMapperFactory implements MapperFactory {
public ObjectMapper instance(HarReaderMode mode) {
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
if (mode == HarReaderMode.LAX) {
module.addDeserializer(Date.class, new ExceptionIgnoringDateDeserializer());
module.addDeserializer(Integer.class, new ExceptionIgnoringIntegerDeserializer());
}
mapper.registerModule(module);
return mapper;
}
}