Class CallbackDataProvider<T,​F>

  • Type Parameters:
    T - data provider data type
    F - data provider filter type
    All Implemented Interfaces:
    BackEndDataProvider<T,​F>, DataProvider<T,​F>, Serializable

    public class CallbackDataProvider<T,​F>
    extends AbstractBackEndDataProvider<T,​F>
    Data provider that uses one callback for fetching items from a back end and another callback for counting the number of available items.
    Since:
    1.0
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Method Detail

      • sizeInBackEnd

        protected int sizeInBackEnd​(Query<T,​F> query)
        Description copied from class: AbstractBackEndDataProvider
        Counts the number of items available in the back end.
        Specified by:
        sizeInBackEnd in class AbstractBackEndDataProvider<T,​F>
        Parameters:
        query - the query that defines filtering to be used for counting the number of items
        Returns:
        the number of available items
      • 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.

        Parameters:
        item - the item to get identifier for; not null
        Returns:
        the identifier for given item; not null