diff --git a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/ListMethodImplementor.java b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/ListMethodImplementor.java index 178987a73fa72..2c46c6172868f 100644 --- a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/ListMethodImplementor.java +++ b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/ListMethodImplementor.java @@ -11,7 +11,9 @@ import static io.quarkus.arc.processor.DotNames.STRING; import static io.quarkus.gizmo.MethodDescriptor.ofConstructor; import static io.quarkus.gizmo.MethodDescriptor.ofMethod; +import static io.quarkus.gizmo.Type.classType; import static io.quarkus.gizmo.Type.intType; +import static io.quarkus.gizmo.Type.parameterizedType; import static io.quarkus.rest.data.panache.deployment.utils.PaginationImplementor.DEFAULT_PAGE_INDEX; import static io.quarkus.rest.data.panache.deployment.utils.PaginationImplementor.DEFAULT_PAGE_SIZE; import static io.quarkus.rest.data.panache.deployment.utils.SignatureMethodCreator.param; @@ -86,11 +88,11 @@ public ListMethodImplementor(Capabilities capabilities) { * rel = "list", * entityClassName = "com.example.Entity" * ) - * public Response list(@QueryParam("page") @DefaultValue("0") int pageIndex, - * @QueryParam("size") @DefaultValue("20") int pageSize, - * @QueryParam("sort") String sortQuery) { + * public Response list(@QueryParam("page") @DefaultValue("0") int pageIndex, + * @QueryParam("size") @DefaultValue("20") int pageSize, + * @QueryParam("sort") List sortQuery) { * Page page = Page.of(pageIndex, pageSize); - * Sort sort = ...; // Build a sort instance by parsing a query param + * Sort sort = ...; // Build a sort instance from String entries of sortQuery * try { * List entities = resource.getAll(page, sort); * // Get the page count, and build first, last, next, previous page instances @@ -117,11 +119,11 @@ public ListMethodImplementor(Capabilities capabilities) { * rel = "list", * entityClassName = "com.example.Entity" * ) - * public Uni list(@QueryParam("page") @DefaultValue("0") int pageIndex, - * @QueryParam("size") @DefaultValue("20") int pageSize, - * @QueryParam("sort") String sortQuery) { + * public Uni list(@QueryParam("page") @DefaultValue("0") int pageIndex, + * @QueryParam("size") @DefaultValue("20") int pageSize, + * @QueryParam("sort") List sortQuery) { * Page page = Page.of(pageIndex, pageSize); - * Sort sort = ...; // Build a sort instance by parsing a query param + * Sort sort = ...; // Build a sort instance from String entries of sortQuery * try { * return resource.getAll(page, sort).map(entities -> { * // Get the page count, and build first, last, next, previous page instances @@ -177,7 +179,7 @@ private void implementPaged(ClassCreator classCreator, ResourceMetadata resource // Method parameters: sort strings, page index, page size, uri info Collection compatibleFieldsForQuery = getFieldsToQuery(resourceMetadata); List parameters = new ArrayList<>(); - parameters.add(param("sort", List.class)); + parameters.add(param("sort", List.class, parameterizedType(classType(List.class), classType(String.class)))); parameters.add(param("page", int.class, intType())); parameters.add(param("size", int.class, intType())); parameters.add(param("uriInfo", UriInfo.class)); @@ -267,7 +269,7 @@ private void implementNotPaged(ClassCreator classCreator, ResourceMetadata resou ResourceProperties resourceProperties, FieldDescriptor resourceFieldDescriptor) { Collection compatibleFieldsForQuery = getFieldsToQuery(resourceMetadata); List parameters = new ArrayList<>(); - parameters.add(param("sort", List.class)); + parameters.add(param("sort", List.class, parameterizedType(classType(List.class), classType(String.class)))); parameters.add(param("namedQuery", String.class)); parameters.addAll(compatibleFieldsForQuery); MethodCreator methodCreator = SignatureMethodCreator.getMethodCreator(getMethodName(), classCreator,