refactor(jackson): 优化Long类型序列化器和反序列化器的类型处理
- 为LongSerializer添加handledType方法重写,明确指定处理Long类型 - 为LongDeserializer添加handledType方法重写,明确指定处理Long类型 - 提升Jackson配置中Long类型处理的准确性和性能
This commit is contained in:
@ -42,6 +42,11 @@ public class JacksonConfig {
|
|||||||
}
|
}
|
||||||
gen.writeString(String.valueOf(value));
|
gen.writeString(String.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Long> handledType() {
|
||||||
|
return Long.class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LongDeserializer extends JsonDeserializer<Long> {
|
public static class LongDeserializer extends JsonDeserializer<Long> {
|
||||||
@ -52,5 +57,10 @@ public class JacksonConfig {
|
|||||||
}
|
}
|
||||||
return Long.parseLong(p.getText());
|
return Long.parseLong(p.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> handledType() {
|
||||||
|
return Long.class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user