cn.k7g.alloy.core.objectmapper.LongToString Maven / Gradle / Ivy
package cn.k7g.alloy.core.objectmapper;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* 对js支持
* @date 2020/2/5 下午6:31
* @author victor-wu
*/
public class LongToString extends JsonSerializer {
@Override
public void serialize(Long aLong, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
if (aLong == null) {
jsonGenerator.writeNull();
return;
}
jsonGenerator.writeString(aLong.toString());
}
}