You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.data.provider.

Class DataProviderWrapper<T,​F,​M>

  • java.lang.Object
    • com.vaadin.flow.data.provider.DataProviderWrapper<T,​F,​M>
  • Type Parameters:

    T - data provider data type

    F - wrapper query filter type

    M - underlying data provider filter type

    All Implemented Interfaces:

    DataProvider<T,​F>, Serializable

    Direct Known Subclasses:

    ConfigurableFilterDataProviderWrapper

    public abstract class DataProviderWrapper<T,​F,​M>
    extends Object
    implements DataProvider<T,​F>

    Wrapper class for modifying, chaining and replacing filters and sorting in a query. Used to create a suitable Query for the underlying data provider with correct filters and sorting.

    Since:

    1.0.

    Author:

    Vaadin Ltd

    See Also:

    Serialized Form

    • Field Detail

      • dataProvider

        protected DataProvider<T,​M> dataProvider

        The actual data provider behind this wrapper.

    • Constructor Detail

      • DataProviderWrapper

        protected DataProviderWrapper​(DataProvider<T,​M> dataProvider)

        Constructs a filtering wrapper for a data provider.

        Parameters:

        dataProvider - the wrapped data provider, not null

    • Method Detail

      • isInMemory

        public boolean isInMemory()

        Description copied from interface: DataProvider

        Gets whether the DataProvider content all available in memory or does it use some external backend.

        Specified by:

        isInMemory in interface DataProvider<T,​F>

        Returns:

        true if all data is in memory; false if not

      • refreshAll

        public void refreshAll()

        Description copied from interface: DataProvider

        Refreshes all data based on currently available data in the underlying provider.

        Specified by:

        refreshAll in interface DataProvider<T,​F>

      • getId

        public Object getId​(T item)

        Description copied from interface: DataProvider

        Gets an identifier for the given item. This identifier is used by the framework to determine equality between two items.

        Default is to use item itself as its own identifier. If the item has Object.equals(Object) and Object.hashCode() implemented in a way that it can be compared to other items, no changes are required.

        Note: This method will be called often by the Framework. It should not do any expensive operations.

        Specified by:

        getId in interface DataProvider<T,​F>

        Parameters:

        item - the item to get identifier for; not null

        Returns:

        the identifier for given item; not null

      • size

        public int size​(Query<T,​F> t)

        Description copied from interface: DataProvider

        Gets the amount of data in this DataProvider.

        Specified by:

        size in interface DataProvider<T,​F>

        Parameters:

        t - query with sorting and filtering

        Returns:

        the size of the data provider

      • fetch

        public Stream<T> fetch​(Query<T,​F> t)

        Description copied from interface: DataProvider

        Fetches data from this DataProvider using given query.

        Specified by:

        fetch in interface DataProvider<T,​F>

        Parameters:

        t - given query to request data

        Returns:

        the result of the query request: a stream of data objects, not null

      • getFilter

        protected abstract M getFilter​(Query<T,​F> query)

        Gets the filter that should be used in the modified Query.

        Parameters:

        query - the current query

        Returns:

        filter for the modified Query