Builder used to create new LocalDataReadRequest
s.
Public Constructor Summary
Builder()
|
Public Method Summary
LocalDataReadRequest.Builder | |
LocalDataReadRequest.Builder |
bucketByTime(int duration, TimeUnit
timeUnit)
Specifies bucket type as
LocalBucket.TYPE_TIME and sets the duration of each bucket.
|
LocalDataReadRequest |
build()
Finishes building and returns the request.
|
LocalDataReadRequest.Builder | |
LocalDataReadRequest.Builder |
setLimit(int limit)
Limits results to the latest
limit data points.
|
LocalDataReadRequest.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public LocalDataReadRequest.Builder aggregate (LocalDataType inputDataType)
Adds the dataType
to aggregate for this request.
Aggregation should be requested in conjunction with
bucketByTime(int, TimeUnit)
. At least one valid detailed data type should be
specified in the request.
The resulting aggregated data can be queried via
LocalDataReadResponse.getBuckets()
and
LocalBucket.getDataSet(LocalDataType)
.
Parameters
inputDataType | The input data type you're aggregating |
---|
Throws
IllegalStateException | If the data type is already requested as detailed |
---|---|
IllegalArgumentException | If the input data type is not supported for aggregation |
NullPointerException | If the data type is null |
public LocalDataReadRequest.Builder bucketByTime (int duration, TimeUnit timeUnit)
Specifies bucket type as LocalBucket.TYPE_TIME
and sets the duration of each bucket.
The detailed data across the time interval of the request is divided into
sub-intervals of length duration
, and aggregation is then performed over
each sub-interval to return one LocalBucket
of aggregated data per sub-interval.
Aggregation is performed for data type(s) specified in the request. Each bucket will
have one LocalDataSet
of aggregated data per requested aggregate LocalDataType
.
Throws
IllegalArgumentException | If another bucket type is already specified in the request or if an invalid duration is specified |
---|
public LocalDataReadRequest build ()
Finishes building and returns the request.
Throws
IllegalStateException | If the builder doesn't have enough state to create a valid request |
---|
public LocalDataReadRequest.Builder read (LocalDataType dataType)
Adds the dataType
to read for this request.
The resulting unaggregated data can be queried via
LocalDataReadResponse.getDataSet(LocalDataType)
.
Parameters
dataType | The data type that you're reading |
---|
Throws
IllegalStateException | If the data type is already requested as aggregate |
---|---|
NullPointerException | If the data type is null |
public LocalDataReadRequest.Builder setLimit (int limit)
Limits results to the latest limit
data points. This parameter is
ignored for aggregated queries. By default there is no limit.
This method is useful to reduce the amount of sent data.
public LocalDataReadRequest.Builder setTimeRange (long start, long end, TimeUnit timeUnit)
Sets the time range for our query. Defined start and end times are required for every read query.
Parameters
start | A start time, in the given unit since epoch, inclusive |
---|---|
end | An end time, in the given unit since epoch, inclusive |
timeUnit | The unit of the start and end timestamps |