ReadRecordsRequestUsingFilters.Builder
public
static
final
class
ReadRecordsRequestUsingFilters.Builder
extends Object
java.lang.Object | |
↳ | android.health.connect.ReadRecordsRequestUsingFilters.Builder<T extends android.health.connect.datatypes.Record> |
Builder class for ReadRecordsRequestUsingFilters
Summary
Public constructors | |
---|---|
Builder(Class<T> recordType)
|
Public methods | |
---|---|
Builder<T>
|
addDataOrigins(DataOrigin dataOrigin)
Sets the data origin filter based on which the read operation is to be performed |
ReadRecordsRequestUsingFilters<T>
|
build()
Returns an Object of For subsequent read requests, |
Builder<T>
|
setAscending(boolean ascending)
Sets ordering of results to be returned based on start time. |
Builder<T>
|
setPageSize(int pageSize)
Sets maximum number of records to be returned by the read operation |
Builder<T>
|
setPageToken(long pageToken)
Sets page token to read the requested page of the result. |
Builder<T>
|
setTimeRangeFilter(TimeRangeFilter timeRangeFilter)
Sets time range b/w which the read operation is to be performed |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (Class<T> recordType)
Parameters | |
---|---|
recordType |
Class : Class object of Record type that needs to be read
This value cannot be null . |
Public methods
addDataOrigins
public Builder<T> addDataOrigins (DataOrigin dataOrigin)
Sets the data origin filter based on which the read operation is to be performed
Parameters | |
---|---|
dataOrigin |
DataOrigin : Adds DataOrigin for which to read records.
If no |
Returns | |
---|---|
Builder<T> |
This value cannot be null . |
build
public ReadRecordsRequestUsingFilters<T> build ()
Returns an Object of ReadRecordsRequestUsingFilters
For subsequent read requests, ReadRecordsRequestUsingFilters
does not allow
both pageToken and sort order to be set together.
If pageToken is set then records will be sorted in same order as the previous result
If both pageToken and sortOrder are not set then by default records will be sorted by start time in ascending order.
Returns | |
---|---|
ReadRecordsRequestUsingFilters<T> |
This value cannot be null . |
Throws | |
---|---|
IllegalStateException |
if both pageToken and sort order is set. |
setAscending
public Builder<T> setAscending (boolean ascending)
Sets ordering of results to be returned based on start time. Ordering cannot be set along with page token for subsequent requests. IllegalState exception is thrown when ordering is set along with the page token.
Parameters | |
---|---|
ascending |
boolean : specifies sorting order of results, if set to true records are sorted on
start time in ascending fashion, else if set to false then in descending. |
Returns | |
---|---|
Builder<T> |
This value cannot be null . |
setPageSize
public Builder<T> setPageSize (int pageSize)
Sets maximum number of records to be returned by the read operation
Parameters | |
---|---|
pageSize |
int : number of records to be returned by the read operation.
This sets to limit number of rows returned by a read. If not set default is 1000 and maximum of 5000 records can be sent. Value is between 1 and 5000 inclusive |
Returns | |
---|---|
Builder<T> |
This value cannot be null . |
setPageToken
public Builder<T> setPageToken (long pageToken)
Sets page token to read the requested page of the result.
Parameters | |
---|---|
pageToken |
long : to read the requested page of the result. -1 if none available |
Returns | |
---|---|
Builder<T> |
This value cannot be null . |
setTimeRangeFilter
public Builder<T> setTimeRangeFilter (TimeRangeFilter timeRangeFilter)
Sets time range b/w which the read operation is to be performed
Parameters | |
---|---|
timeRangeFilter |
TimeRangeFilter : Time range b/w which the read operation is to be performed.
If not time range filter is present all the records will be read without any time
constraints.
This value may be |
Returns | |
---|---|
Builder<T> |
This value cannot be null . |