如何调用.class或者如何从通用类型
中获取类 headerMap.put("accept", MediaType.APPLICATION_JSON_VALUE);
ResponseEntity<PaginationResponse<Category>> response =
restClient.getResource(url, headerMap, **PaginationResponse<Category>.class**);
LOGGER.info("Method getAllCategories() - END");
显示错误
答案 0 :(得分:1)
据我所知,这些信息在运行时是不可用的。 但也许,您可以使用Get generic type of class at runtime中的一些想法。
答案 1 :(得分:1)
答案 2 :(得分:0)
我将此解决方案用于泛型类explanation Rest模板
的Spring实现为here