By Boxfish
Effortless paging for Boxfish Model + Spring Data Paging
- Single command to extract a Pageable from a Model
- Spring JPA Repository compatible
- PagedOutput class to standardise your paged DTO
Depends on:
If you are using the Boxfish Model there will be the time win which producing the Pageable object for your JPA Repositories (or any other Spring Data pagination system) will become too repetitive.
This model sorts that problem out for you with a one-liner:
// Controller.java
@RequestMapping(value = "", method = RequestMethod.GET)
public ResponseEntity<?> list(final @RequestParam Map query) {
final Pageable paging = PagingInfo.from(query);
final PagedOutput<Entity> wrapper = PagedOutput.wrap(repo.list(paging);
return ResponseEntity.ok(wrapper);
}