Package com.oorian.data
Class DataResult<T>
java.lang.Object
com.oorian.data.DataResult<T>
- Type Parameters:
T- the item type
Contains the result of a
DataProvider fetch operation.
Holds the fetched items and the total count of available items (for pagination). The total count represents all items matching the query's filters, not just the items in this page.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> DataResult<T> empty()Creates an empty data result.getItems()Returns the fetched items.intgetSize()Returns the number of items in this result page.intReturns the total count of items matching the query.booleanisEmpty()Returns whether this result contains any items.static <T> DataResult<T> Creates a data result from items and total count.
-
Constructor Details
-
DataResult
Creates a data result.- Parameters:
items- the fetched itemstotalCount- the total number of items matching the query (for pagination)
-
-
Method Details
-
of
Creates a data result from items and total count.- Type Parameters:
T- the item type- Parameters:
items- the fetched itemstotalCount- the total number of available items- Returns:
- a new data result
-
empty
Creates an empty data result.- Type Parameters:
T- the item type- Returns:
- an empty data result with zero total count
-
getItems
Returns the fetched items.- Returns:
- unmodifiable list of items
-
getTotalCount
public int getTotalCount()Returns the total count of items matching the query.- Returns:
- the total item count
-
getSize
public int getSize()Returns the number of items in this result page.- Returns:
- the number of fetched items
-
isEmpty
public boolean isEmpty()Returns whether this result contains any items.- Returns:
trueif the result is empty
-