参数类型泛型传入和泛型传出

public <U, S> R<U> query(S req, String name, Class<U> type) {
        R<String> resp = httpPost(name, JSONObject.toJSONString(req));
        if (!resp.isSuccess()) {
            R.fail("网络问题");
        }
        U result = JSONObject.parseObject(resp.getResult(), type);
        return R.ok(result);
    }

  

posted @ 2023-08-17 10:47  青竹玉简  阅读(54)  评论(0编辑  收藏  举报