18 lines
580 B
Java
18 lines
580 B
Java
package com.xjhs.findmemerchant.common.jackson;
|
|
|
|
import com.fasterxml.jackson.core.JsonParser;
|
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class SafeLongDeserializer extends JsonDeserializer<Long> {
|
|
@Override
|
|
public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
String value = p.getText();
|
|
if (value == null || value.isBlank()) {
|
|
return null;
|
|
}
|
|
return Long.valueOf(value);
|
|
}
|
|
}
|