/** * Get the number of immediate child data items for the parent item returned * by a given query. * * @param query * given query to request the count for * @return the count of child data items for the data item * {@link HierarchicalQuery#getParent()} * * @throws IllegalArgumentException * if the query is not of type HierarchicalQuery */ @Override public default int size(Query<T, F> query) { if (query instanceof HierarchicalQuery<?, ?>) { return getChildCount((HierarchicalQuery<T, F>) query); } throw new IllegalArgumentException( "Hierarchical data provider doesn't support non-hierarchical queries"); }
/** * Gets the stream of direct children for given node. * * @param parent * the parent node * @return the stream of direct children */ private Stream<T> getDirectChildren(T parent) { return doFetchDirectChildren(parent, Range.between(0, getDataProvider() .getChildCount(new HierarchicalQuery<>(filter, parent)))); }
@Override public int getChildCount(HierarchicalQuery<T, F> query) { return dataProvider().getChildCount(new HierarchicalQuery<>( query.getOffset(), query.getLimit(), query.getSortOrders(), query.getInMemorySorting(), getFilter(query), query.getParent())); }