Package com.vaadin.data.provider
Interface HierarchicalDataProvider<T,F>
-
- Type Parameters:
T
- data typeF
- filter type
- All Superinterfaces:
DataProvider<T,F>
,Serializable
- All Known Subinterfaces:
BackEndHierarchicalDataProvider<T,F>
- All Known Implementing Classes:
AbstractBackEndHierarchicalDataProvider
,AbstractHierarchicalDataProvider
,TreeDataProvider
public interface HierarchicalDataProvider<T,F> extends DataProvider<T,F>
A common interface for fetching hierarchical data from a data source, such as an in-memory collection or a backend database.- Since:
- 8.1
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Stream<T>
fetch(Query<T,F> query)
Fetches data from this HierarchicalDataProvider using givenquery
.Stream<T>
fetchChildren(HierarchicalQuery<T,F> query)
Fetches data from this HierarchicalDataProvider using givenquery
.int
getChildCount(HierarchicalQuery<T,F> query)
Get the number of immediate child data items for the parent item returned by a given query.boolean
hasChildren(T item)
Check whether a given item has any children associated with it.default int
size(Query<T,F> query)
Get the number of immediate child data items for the parent item returned by a given query.-
Methods inherited from interface com.vaadin.data.provider.DataProvider
addDataProviderListener, getId, isInMemory, refreshAll, refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
-
-
-
-
Method Detail
-
size
default int size(Query<T,F> query)
Get the number of immediate child data items for the parent item returned by a given query.- Specified by:
size
in interfaceDataProvider<T,F>
- Parameters:
query
- given query to request the count for- Returns:
- the count of child data items for the data item
HierarchicalQuery.getParent()
- Throws:
IllegalArgumentException
- if the query is not of type HierarchicalQuery
-
fetch
default Stream<T> fetch(Query<T,F> query)
Fetches data from this HierarchicalDataProvider using givenquery
. Only the immediate children ofHierarchicalQuery.getParent()
will be returned.NOTE: If your data request is likely to involve I/O channels, see
DataProvider.fetch(Query)
for instructions on how to handle the stream without risking resource leaks.- Specified by:
fetch
in interfaceDataProvider<T,F>
- Parameters:
query
- given query to request data with- Returns:
- a stream of data objects resulting from the query
- Throws:
IllegalArgumentException
- if the query is not of type HierarchicalQuery
-
getChildCount
int getChildCount(HierarchicalQuery<T,F> query)
Get the number of immediate child data items for the parent item returned by a given query.- Parameters:
query
- given query to request the count for- Returns:
- the count of child data items for the data item
HierarchicalQuery.getParent()
-
fetchChildren
Stream<T> fetchChildren(HierarchicalQuery<T,F> query)
Fetches data from this HierarchicalDataProvider using givenquery
. Only the immediate children ofHierarchicalQuery.getParent()
will be returned.NOTE: If your data request is likely to involve I/O channels, see
DataProvider.fetch(Query)
for instructions on how to handle the stream without risking resource leaks.- Parameters:
query
- given query to request data with- Returns:
- a stream of data objects resulting from the query
-
hasChildren
boolean hasChildren(T item)
Check whether a given item has any children associated with it.- Parameters:
item
- the item to check for children- Returns:
- whether the given item has children
-
-