diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java index 8105ea82da5..8bc1294f3b3 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java @@ -9,6 +9,15 @@ */ public interface CountService { + /** + * Counts the number of items, without any filtering. + * + * @return the number of items in the service + */ + default long count() { + return count(null); + } + /** * Counts the number of items that match the given filter. * @@ -16,6 +25,6 @@ public interface CountService { * the filter, or {@code null} to use no filter * @return the number of items in the service that match the filter */ - public long count(@Nullable Filter filter); + long count(@Nullable Filter filter); } diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java index 237efd7afb6..c83ab5542e3 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java @@ -14,6 +14,18 @@ * the type of object to list */ public interface ListService { + /** + * Lists objects of the given type using the paging and sorting + * options provided in the parameters. + * + * @param pageable + * contains information about paging and sorting + * @return a list of objects or an empty list if no objects were found + */ + default List list(Pageable pageable) { + return list(pageable, null); + } + /** * Lists objects of the given type using the paging, sorting and filtering * options provided in the parameters.