当我试图将以下类实例转换为JSON时(使用Jackson)
public class RPCRespond<Result> {
private int code;
private Result result;
private boolean success;
private String failureReason;
public RPCRespond() {
this.code = 0;
this.success = true;
this.result = null;
}
public RPCRespond(Result result) {
this.code = 0;
this.success = true;
this.result = result;
}
public RPCRespond(int code, String failureReason) {
this.code = code;
this.success = false;
this.failureReason = failureReason;
}
public RPCRespond(int code, String failureReason, Object... args) {
this.code = code;
this.success = false;
this.failureReason = String.format(failureReason, args);
}
public …Run Code Online (Sandbox Code Playgroud)