我有这段代码:
Version version = commonClient.authorizedRequestBuilder(commonClient.webTarget
.path("/apps/blabla/default/" + appName + "/" + appName)
.queryParam("object_type", "app"))
.accept(MediaType.APPLICATION_JSON_TYPE)
.get(ClientResponse.class)
.getEntity(new GenericType<Version>() {});
如何修复它以解决此错误?
Error:(38, 17) java: method getEntity in class org.glassfish.jersey.client.ClientResponse cannot be applied to given types;
required: no arguments
found: <anonymous javax.ws.rs.core.GenericType<linqmap.supportool.services.gas.dto.Version>>
reason: actual and formal argument lists differ in length
答案 0 :(得分:0)
getEntity()方法不接受任何参数,因此您无法传递(new GenericType(){})
使用以下代替
Version version = commonClient.authorizedRequestBuilder(commonClient.webTarget
.path("/apps/blabla/default/" + appName + "/" + appName)
.queryParam("object_type", "app"))
.accept(MediaType.APPLICATION_JSON_TYPE)
.get(ClientResponse.class)
.getEntity();