Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 05b4e09

Browse files
committed
Fix package issue
1 parent 36ef570 commit 05b4e09

File tree

22 files changed

+269
-91
lines changed

22 files changed

+269
-91
lines changed

raml-client-generator-core/src/main/java/org/mule/client/codegen/RestClientGenerator.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212

1313
public interface RestClientGenerator {
1414

15-
/**
16-
* @deprecated use {@link #callHttpMethod(JCodeModel, JDefinedClass, JType, OutputVersion, JBodyType, JType, JType, Action, ApiModel))} instead.
17-
*/
18-
@Deprecated
19-
void callHttpMethod(@Nonnull JCodeModel cm, @Nonnull JDefinedClass resourceClass, @Nonnull JType returnType, @Nullable JBodyType bodyType, @Nullable JType queryParameterType, @Nullable JType headerParameterType, @Nonnull Action action, ApiModel apiModel);
20-
15+
2116
void callHttpMethod(@Nonnull JCodeModel cm, @Nonnull JDefinedClass resourceClass, @Nonnull JType returnType, @Nonnull OutputVersion outputVersion, @Nullable JBodyType bodyType, @Nullable JType queryParameterType, @Nullable JType headerParameterType, @Nonnull Action action, ApiModel apiModel);
2217

2318
JMethod createClient(JCodeModel cm, JDefinedClass resourceClass, JMethod baseUrlField);

raml-client-generator-core/src/main/java/org/mule/client/codegen/clientgenerator/Jersey2RestClientGeneratorImpl.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ public class Jersey2RestClientGeneratorImpl implements RestClientGenerator {
6262
private static JClass exceptionClass;
6363
private static JClass responseClass;
6464

65-
@Override
66-
public void callHttpMethod(@Nonnull JCodeModel cm, @Nonnull JDefinedClass resourceClass, @Nonnull JType returnType, @Nullable JBodyType bodyType, @Nullable JType queryParameterType, @Nullable JType headerParameterType, @Nonnull Action action, ApiModel apiModel) {
67-
callHttpMethod(cm, resourceClass, returnType, OutputVersion.v1, bodyType, queryParameterType, headerParameterType, action, apiModel);
68-
}
6965

7066
@Override
7167
public void callHttpMethod(@Nonnull JCodeModel cm, @Nonnull JDefinedClass resourceClass, @Nonnull JType returnType, @Nonnull OutputVersion outputVersion, @Nullable JBodyType bodyType, @Nullable JType queryParameterType, @Nullable JType headerParameterType, @Nonnull Action action, ApiModel apiModel) {
@@ -205,8 +201,8 @@ public void callHttpMethod(@Nonnull JCodeModel cm, @Nonnull JDefinedClass resour
205201
jInvocation = responseVal.invoke("getEntity");
206202
} else {
207203
if (returnType instanceof JClass && !((JClass) returnType).getTypeParameters().isEmpty()) {
208-
final JClass narrow = cm.anonymousClass(cm.ref(GenericType.class).narrow(returnType));
209-
jInvocation = responseVal.invoke("readEntity").arg(JExpr._new(narrow));
204+
jInvocation = responseVal.invoke("readEntity").arg(JExpr.direct("\n" +
205+
"new " + GenericType.class.getName() + "<" + returnType.fullName() + ">() {}"));
210206
} else {
211207
jInvocation = responseVal.invoke("readEntity").arg(JExpr.dotclass(cm.ref(returnType.fullName())));
212208
}

raml-client-generator-core/src/test/java/org/mule/client/codegen/RamlJavaClientGeneratorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public static Iterable<Object[]> folders() {
5555
{"same_path_multiple_times"},
5656
{"type_decl"},
5757
{"use_optional"},
58-
{"x-www-form-urlencoded"}
58+
{"x-www-form-urlencoded"},
59+
{"xml_mimetype"},
5960
});
6061
}
6162

raml-client-generator-core/src/test/resources/v1/from-example/output/from-example/resource/users/Users.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -46,11 +45,8 @@ public List<UsersGETResponse> get() {
4645
Response.StatusType statusInfo = response.getStatusInfo();
4746
throw new ClientAPIException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4847
}
49-
return response.readEntity(new GenericType<List<UsersGETResponse>>() {
50-
51-
52-
}
53-
);
48+
return response.readEntity((
49+
new javax.ws.rs.core.GenericType<java.util.List<from-example.resource.users.model.UsersGETResponse>>() {}));
5450
}
5551

5652
}

raml-client-generator-core/src/test/resources/v1/include_schema/output/include_schema/resource/cs/login/Login.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -42,11 +41,8 @@ public List<AuthorizationJson> post() {
4241
Response.StatusType statusInfo = response.getStatusInfo();
4342
throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4443
}
45-
return response.readEntity(new GenericType<List<AuthorizationJson>>() {
46-
47-
48-
}
49-
);
44+
return response.readEntity((
45+
new javax.ws.rs.core.GenericType<java.util.List<include_schema.resource.cs.login.model.AuthorizationJson>>() {}));
5046
}
5147

5248
}

raml-client-generator-core/src/test/resources/v1/list/output/list/resource/users/Users.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -46,11 +45,8 @@ public List<UsersGETResponse> get() {
4645
Response.StatusType statusInfo = response.getStatusInfo();
4746
throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4847
}
49-
return response.readEntity(new GenericType<List<UsersGETResponse>>() {
50-
51-
52-
}
53-
);
48+
return response.readEntity((
49+
new javax.ws.rs.core.GenericType<java.util.List<list.resource.users.model.UsersGETResponse>>() {}));
5450
}
5551

5652
}

raml-client-generator-core/src/test/resources/v1/oauth20-global/output/oauth20-global/resource/api/Api.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -47,11 +46,8 @@ public List<ApiGETResponse> get(String authorizationToken) {
4746
Response.StatusType statusInfo = response.getStatusInfo();
4847
throw new CoreServicesAPIReferenceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4948
}
50-
return response.readEntity(new GenericType<List<ApiGETResponse>>() {
51-
52-
53-
}
54-
);
49+
return response.readEntity((
50+
new javax.ws.rs.core.GenericType<java.util.List<oauth20-global.resource.api.model.ApiGETResponse>>() {}));
5551
}
5652

5753
}

raml-client-generator-core/src/test/resources/v1/oauth20/output/oauth20/resource/api/Api.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -47,11 +46,8 @@ public List<ApiGETResponse> get(String authorizationToken) {
4746
Response.StatusType statusInfo = response.getStatusInfo();
4847
throw new CoreServicesAPIReferenceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4948
}
50-
return response.readEntity(new GenericType<List<ApiGETResponse>>() {
51-
52-
53-
}
54-
);
49+
return response.readEntity((
50+
new javax.ws.rs.core.GenericType<java.util.List<oauth20.resource.api.model.ApiGETResponse>>() {}));
5551
}
5652

5753
}

raml-client-generator-core/src/test/resources/v1/oauth_override/output/oauth_override/resource/api/Api.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -51,11 +50,8 @@ public List<ApiGETResponse> get(String authorizationToken) {
5150
Response.StatusType statusInfo = response.getStatusInfo();
5251
throw new CoreServicesAPIReferenceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
5352
}
54-
return response.readEntity(new GenericType<List<ApiGETResponse>>() {
55-
56-
57-
}
58-
);
53+
return response.readEntity((
54+
new javax.ws.rs.core.GenericType<java.util.List<oauth_override.resource.api.model.ApiGETResponse>>() {}));
5955
}
6056

6157
}

raml-client-generator-core/src/test/resources/v2/from-example/output/from-example/resource/users/Users.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import javax.ws.rs.client.Client;
66
import javax.ws.rs.client.WebTarget;
7-
import javax.ws.rs.core.GenericType;
87
import javax.ws.rs.core.MediaType;
98
import javax.ws.rs.core.Response;
109
import javax.ws.rs.core.Response.Status.Family;
@@ -47,11 +46,8 @@ public ClientAPIResponse<List<UsersGETResponseBody>> get() {
4746
Response.StatusType statusInfo = response.getStatusInfo();
4847
throw new ClientAPIException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response);
4948
}
50-
ClientAPIResponse<List<UsersGETResponseBody>> apiResponse = new ClientAPIResponse<List<UsersGETResponseBody>>(response.readEntity(new GenericType<List<UsersGETResponseBody>>() {
51-
52-
53-
}
54-
), response.getStringHeaders(), response);
49+
ClientAPIResponse<List<UsersGETResponseBody>> apiResponse = new ClientAPIResponse<List<UsersGETResponseBody>>(response.readEntity((
50+
new javax.ws.rs.core.GenericType<java.util.List<from-example.resource.users.model.UsersGETResponseBody>>() {})), response.getStringHeaders(), response);
5551
return apiResponse;
5652
}
5753

0 commit comments

Comments
 (0)