com.vaadin.flow.spring.data.

Interface VaadinSpringDataHelpers

All Superinterfaces:

Serializable

public interface VaadinSpringDataHelpers extends Serializable

Contains helper methods to work with Spring Data based back-ends and Vaadin components.

  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    fromPagingRepository(org.springframework.data.repository.PagingAndSortingRepository<T,?> repo)

    Binds all items from a given paging Spring Data repository to Grid.

    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 Data PageRequest based on the Vaadin Query object.

  • Method Details

    • toSpringDataSort

      static org.springframework.data.domain.Sort toSpringDataSort(Query<?,?> vaadinQuery)

      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

      static org.springframework.data.domain.PageRequest toSpringPageRequest(Query<?,?> vaadinQuery)

      Creates a Spring Data PageRequest based on the Vaadin Query 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 to Grid. 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.