refactor(jackson): 优化Long类型序列化器和反序列化器的类型处理

- 为LongSerializer添加handledType方法重写,明确指定处理Long类型
- 为LongDeserializer添加handledType方法重写,明确指定处理Long类型
- 提升Jackson配置中Long类型处理的准确性和性能
This commit is contained in:
zkh
2025-12-31 12:07:24 +08:00
parent ab39c0f9b2
commit 88afa8b47e

View File

@ -42,6 +42,11 @@ public class JacksonConfig {
}
gen.writeString(String.valueOf(value));
}
@Override
public Class<Long> handledType() {
return Long.class;
}
}
public static class LongDeserializer extends JsonDeserializer<Long> {
@ -52,5 +57,10 @@ public class JacksonConfig {
}
return Long.parseLong(p.getText());
}
@Override
public Class<?> handledType() {
return Long.class;
}
}
}