package com.cassiomolin.example.api.providers;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;

import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

/**
 * Provider for {@link ObjectMapper}.
 *
 * @author cassiomolin
 */
@Provider
public class ObjectMapperProvider implements ContextResolver<ObjectMapper> {

    private final ObjectMapper mapper;

    public ObjectMapperProvider() {
        mapper = createObjectMapper();
    }

    @Override
    public ObjectMapper getContext(Class<?> type) {
        return mapper;
    }

    private static ObjectMapper createObjectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new ParameterNamesModule());
        mapper.registerModule(new Jdk8Module());
        mapper.registerModule(new JavaTimeModule());
        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
        return mapper;
    }
}
@@ -41,16 +41,78 @@
 iders;%0A%0A
+import com.fasterxml.jackson.databind.DeserializationFeature;%0A
 import c
@@ -904,24 +904,25 @@
 tMapper() %7B%0A
+%0A
         Obje
@@ -963,67 +963,9 @@
 ();%0A
-        mapper.registerModule(new ParameterNamesModule());
 %0A
+
     
@@ -1081,73 +1081,408 @@
 per.
-configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+registerModule(new ParameterNamesModule());%0A%0A        mapper.enable(SerializationFeature.INDENT_OUTPUT);%0A        mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);%0A        mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);%0A%0A        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);%0A        mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);%0A
 %0A   

Update ContextResolver for ObjectMapper.