2019-06-24 22:27
解决方法实际上很简单,不需要那么复杂:
第一步:
public static class PGObjectSerializer implements ObjectSerializer {
public final static PGObjectSerializer instance = new PGObjectSerializer();
@Override
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
if(object!=null)
serializer.out.write(object.toString());
else
serializer.out.writeNull();
}
}
第二步:
SerializeConfig.getGlobalInstance().put(PGobject.class, PGObjectSerializer.instance);