Q - the child class that extends this abstract classR - the type the child class' execute()-function returnspublic abstract class APIQuery<Q extends APIQuery,R> extends AbstractQuery<Q,R>
| Modifier and Type | Field and Description |
|---|---|
protected static RateLimiter |
rateLimiter
The general rate limiter for all API calls.
|
protected String |
resourceValue
The resource value, e.g.
|
logger| Modifier | Constructor and Description |
|---|---|
protected |
APIQuery(String resourceValue)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildURL()
Generates a String URL based on the supplied values.
|
<T extends R> |
execute(Class<T> type)
Executes this query, returning any result.
|
protected RateLimiter |
getRateLimiter()
Returns the rate limiter to use in the makeRequest()-function.
|
protected abstract String |
resourceString()
Gives the resource string of this Query, e.g.
|
Q |
slowMode()
Makes the Query execute in slow mode, reducing the rate limit from 6
requests per 4 seconds to only 1 request per second.
|
protected void |
validateQueryParameters()
Validates the query parameters before executing the query.
|
closeInputStreamQuietly, execute, makeRequest, translateResponseprotected static final RateLimiter rateLimiter
protected final String resourceValue
protected APIQuery(String resourceValue)
resourceValue - the resource valuepublic Q slowMode()
protected RateLimiter getRateLimiter()
public <T extends R> T execute(Class<T> type)
AbstractQueryexecute in class AbstractQuery<Q extends APIQuery,R>T - the type to returntype - the type to returnprotected void validateQueryParameters()
AbstractQueryvalidateQueryParameters in class AbstractQuery<Q extends APIQuery,R>protected String buildURL()
AbstractQuerybuildURL in class AbstractQuery<Q extends APIQuery,R>protected abstract String resourceString()
Copyright © 2016. All rights reserved.