1111import static io .quarkus .arc .processor .DotNames .STRING ;
1212import static io .quarkus .gizmo .MethodDescriptor .ofConstructor ;
1313import static io .quarkus .gizmo .MethodDescriptor .ofMethod ;
14+ import static io .quarkus .gizmo .Type .classType ;
1415import static io .quarkus .gizmo .Type .intType ;
16+ import static io .quarkus .gizmo .Type .parameterizedType ;
1517import static io .quarkus .rest .data .panache .deployment .utils .PaginationImplementor .DEFAULT_PAGE_INDEX ;
1618import static io .quarkus .rest .data .panache .deployment .utils .PaginationImplementor .DEFAULT_PAGE_SIZE ;
1719import static io .quarkus .rest .data .panache .deployment .utils .SignatureMethodCreator .param ;
@@ -86,11 +88,11 @@ public ListMethodImplementor(Capabilities capabilities) {
8688 * rel = "list",
8789 * entityClassName = "com.example.Entity"
8890 * )
89- * public Response list(@ QueryParam("page") @ DefaultValue("0") int pageIndex,
90- * @QueryParam("size") @ DefaultValue("20") int pageSize,
91- * @QueryParam("sort") String sortQuery) {
91+ * public Response list(@ QueryParam("page") @ DefaultValue("0") int pageIndex,
92+ * @QueryParam("size") @ DefaultValue("20") int pageSize,
93+ * @QueryParam("sort") List< String> sortQuery) {
9294 * Page page = Page.of(pageIndex, pageSize);
93- * Sort sort = ...; // Build a sort instance by parsing a query param
95+ * Sort sort = ...; // Build a sort instance from String entries of sortQuery
9496 * try {
9597 * List<Entity> entities = resource.getAll(page, sort);
9698 * // Get the page count, and build first, last, next, previous page instances
@@ -117,11 +119,11 @@ public ListMethodImplementor(Capabilities capabilities) {
117119 * rel = "list",
118120 * entityClassName = "com.example.Entity"
119121 * )
120- * public Uni<Response> list(@ QueryParam("page") @ DefaultValue("0") int pageIndex,
121- * @QueryParam("size") @ DefaultValue("20") int pageSize,
122- * @QueryParam("sort") String sortQuery) {
122+ * public Uni<Response> list(@ QueryParam("page") @ DefaultValue("0") int pageIndex,
123+ * @QueryParam("size") @ DefaultValue("20") int pageSize,
124+ * @QueryParam("sort") List< String> sortQuery) {
123125 * Page page = Page.of(pageIndex, pageSize);
124- * Sort sort = ...; // Build a sort instance by parsing a query param
126+ * Sort sort = ...; // Build a sort instance from String entries of sortQuery
125127 * try {
126128 * return resource.getAll(page, sort).map(entities -> {
127129 * // Get the page count, and build first, last, next, previous page instances
@@ -177,7 +179,7 @@ private void implementPaged(ClassCreator classCreator, ResourceMetadata resource
177179 // Method parameters: sort strings, page index, page size, uri info
178180 Collection <SignatureMethodCreator .Parameter > compatibleFieldsForQuery = getFieldsToQuery (resourceMetadata );
179181 List <SignatureMethodCreator .Parameter > parameters = new ArrayList <>();
180- parameters .add (param ("sort" , List .class ));
182+ parameters .add (param ("sort" , List .class , parameterizedType ( classType ( List . class ), classType ( String . class )) ));
181183 parameters .add (param ("page" , int .class , intType ()));
182184 parameters .add (param ("size" , int .class , intType ()));
183185 parameters .add (param ("uriInfo" , UriInfo .class ));
@@ -267,7 +269,7 @@ private void implementNotPaged(ClassCreator classCreator, ResourceMetadata resou
267269 ResourceProperties resourceProperties , FieldDescriptor resourceFieldDescriptor ) {
268270 Collection <SignatureMethodCreator .Parameter > compatibleFieldsForQuery = getFieldsToQuery (resourceMetadata );
269271 List <SignatureMethodCreator .Parameter > parameters = new ArrayList <>();
270- parameters .add (param ("sort" , List .class ));
272+ parameters .add (param ("sort" , List .class , parameterizedType ( classType ( List . class ), classType ( String . class )) ));
271273 parameters .add (param ("namedQuery" , String .class ));
272274 parameters .addAll (compatibleFieldsForQuery );
273275 MethodCreator methodCreator = SignatureMethodCreator .getMethodCreator (getMethodName (), classCreator ,
0 commit comments