com.vaadin.data.provider.
Class Query<T,F>
- java.lang.Object
-
- com.vaadin.data.provider.Query<T,F>
-
Type Parameters:
T
- bean typeF
- filter typeAll Implemented Interfaces:
Direct Known Subclasses:
public class Query<T,F> extends Object implements Serializable
Immutable query object used to request data from a backend. Contains index limits, sorting and filtering information.
Since:
8.0
See Also:
-
-
Constructor Summary
Constructors Constructor Description Query()
Constructs a Query for all rows from 0 to
Integer.MAX_VALUE
without sorting and filtering.Query(int offset, int limit, List<QuerySortOrder> sortOrders, Comparator<T> inMemorySorting, F filter)
Constructs a new Query object with given offset, limit, sorting and filtering.
Query(F filter)
Constructs a Query for all rows from 0 to
Integer.MAX_VALUE
with filtering.
-
Method Summary
All Methods Modifier and Type Method Description Optional<F>
getFilter()
Gets the filter for items to fetch.
Comparator<T>
getInMemorySorting()
Gets the comparator for sorting in-memory data.
int
getLimit()
Gets the limit of items to fetch.
int
getOffset()
Gets the first index of items to fetch.
List<QuerySortOrder>
getSortOrders()
Gets the sorting for items to fetch.
-
-
-
Constructor Detail
-
Query
public Query()
Constructs a Query for all rows from 0 to
Integer.MAX_VALUE
without sorting and filtering.
-
Query
public Query(F filter)
Constructs a Query for all rows from 0 to
Integer.MAX_VALUE
with filtering.Parameters:
filter
- back end filter of a suitable type for the data provider; can be null
-
Query
public Query(int offset, int limit, List<QuerySortOrder> sortOrders, Comparator<T> inMemorySorting, F filter)
Constructs a new Query object with given offset, limit, sorting and filtering.
Parameters:
offset
- first index to fetchlimit
- fetched item countsortOrders
- sorting order for fetching; used for sorting backendsinMemorySorting
- comparator for sorting in-memory datafilter
- filtering for fetching; can be null
-
-
Method Detail
-
getOffset
public int getOffset()
Gets the first index of items to fetch. The offset is only used when fetching items, but not when counting the number of available items.
Returns:
offset for data request
-
getLimit
public int getLimit()
Gets the limit of items to fetch. The limit is only used when fetching items, but not when counting the number of available items.
Note: It is possible that
offset + limit > item count
Returns:
number of items to fetch
-
getSortOrders
public List<QuerySortOrder> getSortOrders()
Gets the sorting for items to fetch. This list of sort orders is used for sorting backends. The sort orders are only used when fetching items, but not when counting the number of available items.
Note: Sort orders and in-memory sorting are mutually exclusive. If the
DataProvider
handles one, it should ignore the other.Returns:
list of sort orders
-
getFilter
public Optional<F> getFilter()
Gets the filter for items to fetch.
Returns:
optional filter
-
getInMemorySorting
public Comparator<T> getInMemorySorting()
Gets the comparator for sorting in-memory data. The comparator is only used when fetching items, but not when counting the number of available items.
Note: Sort orders and in-memory sorting are mutually exclusive. If the
DataProvider
handles one, it should ignore the other.Returns:
sorting comparator
-
-