增加 NumberSerializer 注释

pull/2/head
YunaiV 2022-11-30 20:17:05 +08:00
parent cb0daf3c23
commit 650133dda4
1 changed files with 9 additions and 3 deletions

View File

@ -5,20 +5,26 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import java.io.IOException; import java.io.IOException;
/** /**
* Long * Long
* <p> *
* longstring * long string JavaScript 2^53-1
*
* @author
*/ */
@JacksonStdImpl @JacksonStdImpl
public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer { public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer {
private static final long MAX_SAFE_INTEGER = 9007199254740991L; private static final long MAX_SAFE_INTEGER = 9007199254740991L;
private static final long MIN_SAFE_INTEGER = -9007199254740991L; private static final long MIN_SAFE_INTEGER = -9007199254740991L;
public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class); public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class);
public NumberSerializer(Class<? extends Number> rawType) { public NumberSerializer(Class<? extends Number> rawType) {
super(rawType); super(rawType);
} }
@Override @Override
public void serialize(Number value, JsonGenerator gen, SerializerProvider serializers) throws IOException { public void serialize(Number value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// 超出范围 序列化位字符串 // 超出范围 序列化位字符串