io.leopard.json.serialize.VOSerializerProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leopard-json Show documentation
Show all versions of leopard-json Show documentation
规范、简化Json操作,可选Jackson、FastJson实现。并可在TopNB查看耗时统计信息。
The newest version!
package io.leopard.json.serialize;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
import com.fasterxml.jackson.databind.ser.SerializerFactory;
public class VOSerializerProvider extends DefaultSerializerProvider {
private static final long serialVersionUID = 1L;
public VOSerializerProvider() {
super();
}
protected VOSerializerProvider(SerializerProvider src, SerializationConfig config, SerializerFactory f) {
super(src, config, f);
}
public void serializeValue(JsonGenerator gen, Object value) throws IOException {
System.out.println("serializeValue:" + value);
super.serializeValue(gen, value);
}
@Override
public VOSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) {
return new VOSerializerProvider(this, config, jsf);
}
}