public class QueryBuilder extends Object
Modifier and Type | Method and Description |
---|---|
QueryMetric |
addMetric(String name)
The metric to query for.
|
String |
build()
Returns the JSON string built by the builder.
|
int |
getCacheTime()
Returns the cache time.
|
Date |
getEndAbsolute()
Returns the absolute range end time.
|
RelativeTime |
getEndRelative()
Returns the relative range end time.
|
static QueryBuilder |
getInstance()
Returns a new query builder.
|
List<QueryMetric> |
getMetrics()
Returns the list metrics to query for.
|
Date |
getStartAbsolute()
Returns the absolute range start time.
|
RelativeTime |
getStartRelative()
Returns the relative range start time.
|
QueryBuilder |
setCacheTime(int cacheTime)
How long to cache this exact query.
|
QueryBuilder |
setEnd(Date end)
The ending value of the time range.
|
QueryBuilder |
setEnd(int duration,
TimeUnit unit)
The ending time of the time range relative to now.
|
QueryBuilder |
setStart(Date start)
The beginning time of the time range.
|
QueryBuilder |
setStart(int duration,
TimeUnit unit)
The beginning time of the time range relative to now.
|
public QueryBuilder setStart(Date start)
start
- start timepublic QueryBuilder setStart(int duration, TimeUnit unit)
duration
- relative time valueunit
- unit of timepublic QueryBuilder setEnd(Date end)
end
- end timepublic QueryBuilder setEnd(int duration, TimeUnit unit)
duration
- relative time valueunit
- unit of timepublic QueryBuilder setCacheTime(int cacheTime)
cacheTime
- cache time in millisecondspublic static QueryBuilder getInstance()
public QueryMetric addMetric(String name)
name
- metric namepublic Date getStartAbsolute()
public Date getEndAbsolute()
public RelativeTime getStartRelative()
public RelativeTime getEndRelative()
public int getCacheTime()
public List<QueryMetric> getMetrics()
public String build() throws IOException
IOException
- if the query is invalid and cannot be converted to JSONCopyright © 2014. All rights reserved.