Package net.solarnetwork.dao
Class BasicFilterResults<M extends Identity<K>,K>
java.lang.Object
net.solarnetwork.dao.BasicFilterResults<M,K>
- All Implemented Interfaces:
Iterable<M>,FilterResults<M,K>
public class BasicFilterResults<M extends Identity<K>,K>
extends Object
implements FilterResults<M,K>
Basic implementation of
FilterResults.- Since:
- 1.59
- Version:
- 1.2
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionBasicFilterResults(Iterable<M> results) Constructor.BasicFilterResults(Iterable<M> results, Long totalResults, int startingOffset, int returnedResultCount) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends Identity<K>,K>
FilterResults<M,K> filterResults(Iterable<M> data, PaginationCriteria criteria, Long totalResults, int returnedResults) Create aFilterResultsinstance.Get the actual results.intGet the number of results that matched the query.intGet the starting offset of the returned results.Get a total number of available results, if known.iterator()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
BasicFilterResults
public BasicFilterResults(Iterable<M> results, Long totalResults, int startingOffset, int returnedResultCount) Constructor.- Parameters:
results- the results iterabletotalResults- the total available results, or nullstartingOffset- the starting offsetreturnedResultCount- the count of objects inresults
-
BasicFilterResults
Constructor.This total results count will be set to null, the starting offset to 0, and the returned result count will be derived from the number of items in
results.- Parameters:
results- the results iterable
-
-
Method Details
-
filterResults
public static <M extends Identity<K>,K> FilterResults<M,K> filterResults(Iterable<M> data, PaginationCriteria criteria, Long totalResults, int returnedResults) Create aFilterResultsinstance.- Type Parameters:
M- the result typeK- the result key type- Parameters:
data- the result datacriteria- the criteria used to produce the resultstotalResults- the total result count, if availablereturnedResults- the returned results count- Returns:
- the results instance
- Since:
- 1.1
-
iterator
-
toString
-
getResults
Description copied from interface:FilterResultsGet the actual results.These are the same results returned by
Iterable.iterator().- Specified by:
getResultsin interfaceFilterResults<M extends Identity<K>,K> - Returns:
- the results, never null
-
getTotalResults
Description copied from interface:FilterResultsGet a total number of available results, if known.If this result represents partial results and the total count of available results is known, this value represents that total count of available results.
- Specified by:
getTotalResultsin interfaceFilterResults<M extends Identity<K>,K> - Returns:
- total available results, or null if not known
-
getStartingOffset
public int getStartingOffset()Description copied from interface:FilterResultsGet the starting offset of the returned results.- Specified by:
getStartingOffsetin interfaceFilterResults<M extends Identity<K>,K> - Returns:
- the starting offset
-
getReturnedResultCount
public int getReturnedResultCount()Description copied from interface:FilterResultsGet the number of results that matched the query.- Specified by:
getReturnedResultCountin interfaceFilterResults<M extends Identity<K>,K> - Returns:
- the number of returned results
-