MCPcopy Create free account
hub / github.com/diyhi/bbs / buildCustomModule

Method buildCustomModule

src/main/java/cms/config/JacksonConfig.java:60–73  ·  view source on GitHub ↗

构建包含 Long 和 LocalDateTime 定制的模块

()

Source from the content-addressed store, hash-verified

58 * 构建包含 Long 和 LocalDateTime 定制的模块
59 */
60 private SimpleModule buildCustomModule() {
61 SimpleModule simpleModule = new SimpleModule();
62
63 // 将所有的 long 类型序列化为 string
64 simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
65 simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
66
67 //序列化LocalDateTime 类型
68 simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(FORMATTER));
69 //反序列化 LocalDateTime 类型
70 simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(FORMATTER));
71
72 return simpleModule;
73 }
74
75
76

Callers 1

objectMapperMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected