package org.folio.rest.tools.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

/**
 * @author shale
 *
 */
public class ObjectMapperTool {

  public static ObjectMapper getMapper(){
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
    return mapper;
  }

}

@@ -30,16 +30,72 @@
 utils;%0A%0A
+import com.fasterxml.jackson.databind.JsonDeserializer;%0A
 import c
@@ -134,24 +134,24 @@
 jectMapper;%0A
-
 import com.f
@@ -197,16 +197,75 @@
 Feature;
+%0Aimport com.fasterxml.jackson.databind.module.SimpleModule;
 %0A%0A/**%0A *
@@ -322,21 +322,28 @@
 l %7B%0A%0A  p
-ublic
+rivate final
  static 
@@ -355,18 +355,42 @@
 tMapper 
-ge
+DEFAULT_MAPPER = new Objec
 tMapper(
@@ -394,13 +394,33 @@
 er()
-%7B%0A   
+;%0A%0A  private final static
  Obj
@@ -429,22 +429,22 @@
 tMapper 
-mapper
+MAPPER
  = new O
@@ -462,102 +462,575 @@
 ();%0A
-    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);%0A    return mapper
+%0A  static %7B%0A    DEFAULT_MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);%0A    MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);%0A  %7D%0A%0A  public static ObjectMapper getDefaultMapper() %7B%0A    return DEFAULT_MAPPER;%0A  %7D%0A%0A  public static ObjectMapper getMapper() %7B%0A    return MAPPER;%0A  %7D%0A%0A  public static %3CM, D extends JsonDeserializer%3CM%3E%3E void registerDeserializer(Class%3CM%3E clazz, D deserializer) %7B%0A    SimpleModule module = new SimpleModule();%0A    module.addDeserializer(clazz, deserializer);%0A    MAPPER.registerModule(module)
 ;%0A  

allow registering deserializater to static object mapper