Package com.vaadin.flow.spring.data
Interface VaadinSpringDataHelpers
- All Superinterfaces:
Serializable
Contains helper methods to work with Spring Data based back-ends and Vaadin
components.
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> CallbackDataProvider.FetchCallback<T,
Void> fromPagingRepository
(org.springframework.data.repository.PagingAndSortingRepository<T, ?> repo) Binds all items from a given paging Spring Data repository toGrid
.static org.springframework.data.domain.Sort
toSpringDataSort
(Query<?, ?> vaadinQuery) Translates given Query object from a Vaadin component to Spring Data Sort object.static org.springframework.data.domain.PageRequest
toSpringPageRequest
(Query<?, ?> vaadinQuery) Creates a Spring DataPageRequest
based on the VaadinQuery
object.
-
Method Details
-
toSpringDataSort
Translates given Query object from a Vaadin component to Spring Data Sort object.Can be used as a helper when making a lazy data binding from a Vaadin component to a Spring Data based back-end. The method expects Vaadin sort data to include the property name.
- Parameters:
vaadinQuery
- the Vaadin Query object passed by the component- Returns:
- the Sort object that can be passed for Spring Data based back-end
-
toSpringPageRequest
Creates a Spring DataPageRequest
based on the VaadinQuery
object. Takes sort into account, based on properties.- Parameters:
vaadinQuery
- the query object from Vaadin component- Returns:
- a
PageRequest
that can be passed for Spring Data based back-end
-
fromPagingRepository
static <T> CallbackDataProvider.FetchCallback<T,Void> fromPagingRepository(org.springframework.data.repository.PagingAndSortingRepository<T, ?> repo) Binds all items from a given paging Spring Data repository toGrid
. Usage example:grid.setItems(fromPagingRepository(repo));
- Type Parameters:
T
- the type of items to bind- Parameters:
repo
- the repository where the results should be fetched from- Returns:
- the FetchCallback that makes the lazy binding to
Grid
.
-