package me.solby.itool.json;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.text.SimpleDateFormat;

/**
 * @author majhdk
 * @DESCRIPTION 自定义ObjectMapper
 * @date 2018-12-01
 */
class CustomObjectMapper extends ObjectMapper {

    /**
     * 通用时间格式
     */
    private static final String DATE_FORMAT_PATTERN = "yyyy-mm-dd HH:mm:ss";

    CustomObjectMapper() {
        //todo 添加java8时间支持
        this.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        this.setDateFormat(new SimpleDateFormat(DATE_FORMAT_PATTERN));
    }

}

@@ -189,16 +189,201 @@
 tMapper;
+%0Aimport com.fasterxml.jackson.datatype.jdk8.Jdk8Module;%0Aimport com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;%0Aimport com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
 %0A%0Aimport
@@ -678,35 +678,8 @@
 ) %7B%0A
-        //todo %E6%B7%BB%E5%8A%A0java8%E6%97%B6%E9%97%B4%E6%94%AF%E6%8C%81%0A
     
@@ -817,16 +817,16 @@
 RTIES);%0A
-
         
@@ -887,16 +887,132 @@
 TTERN));
+%0A%0A        //models%0A        this.registerModules(new Jdk8Module(), new JavaTimeModule(), new ParameterNamesModule());
 %0A    %7D%0A%0A

add java new time module register