public static class GeoApiContext.Builder
extends java.lang.Object
GeoApiContext.| Constructor | Description |
|---|---|
Builder() |
Builder pattern for the enclosing
GeoApiContext. |
Builder(GeoApiContext.RequestHandler.Builder builder) |
| Modifier and Type | Method | Description |
|---|---|---|
GeoApiContext.Builder |
apiKey(java.lang.String apiKey) |
Sets the API Key to use for authorizing requests.
|
GeoApiContext |
build() |
Converts this builder into a
GeoApiContext. |
GeoApiContext.Builder |
channel(java.lang.String channel) |
Sets the default channel for requests (can be overridden by requests).
|
GeoApiContext.Builder |
connectTimeout(long timeout,
java.util.concurrent.TimeUnit unit) |
Sets the default connect timeout for new connections.
|
GeoApiContext.Builder |
disableRetries() |
Disables retries completely, by setting max retries to 0 and retry timeout to 0.
|
GeoApiContext.Builder |
enterpriseCredentials(java.lang.String clientId,
java.lang.String cryptographicSecret) |
Sets the ClientID/Secret pair to use for authorizing requests.
|
GeoApiContext.Builder |
maxRetries(java.lang.Integer maxRetries) |
Sets the maximum number of times each retry-able errors will be retried.
|
GeoApiContext.Builder |
proxy(java.net.Proxy proxy) |
Sets the proxy for new connections.
|
GeoApiContext.Builder |
proxyAuthentication(java.lang.String proxyUserName,
java.lang.String proxyUserPassword) |
set authentication for proxy
|
GeoApiContext.Builder |
queryRateLimit(int maxQps) |
Sets the maximum number of queries that will be executed during a 1 second interval.
|
GeoApiContext.Builder |
readTimeout(long timeout,
java.util.concurrent.TimeUnit unit) |
Sets the default read timeout for new connections.
|
GeoApiContext.Builder |
requestHandlerBuilder(GeoApiContext.RequestHandler.Builder builder) |
Changes the RequestHandler.Builder strategy to change between the
OkHttpRequestHandler and the GaeRequestHandler. |
GeoApiContext.Builder |
retryTimeout(long timeout,
java.util.concurrent.TimeUnit unit) |
Sets the cumulative time limit for which retry-able errors will be retried.
|
GeoApiContext.Builder |
setIfExceptionIsAllowedToRetry(java.lang.Class<? extends ApiException> exception,
boolean allowedToRetry) |
Allows specific API exceptions to be retried or not retried.
|
GeoApiContext.Builder |
writeTimeout(long timeout,
java.util.concurrent.TimeUnit unit) |
Sets the default write timeout for new connections.
|
public Builder()
GeoApiContext.public Builder(GeoApiContext.RequestHandler.Builder builder)
public GeoApiContext.Builder requestHandlerBuilder(GeoApiContext.RequestHandler.Builder builder)
OkHttpRequestHandler and the GaeRequestHandler.builder - The RequestHandler.Builder to use for build()OkHttpRequestHandler,
GaeRequestHandlerpublic GeoApiContext.Builder apiKey(java.lang.String apiKey)
apiKey - The API Key to use.public GeoApiContext.Builder enterpriseCredentials(java.lang.String clientId, java.lang.String cryptographicSecret)
clientId - The Client ID to use.cryptographicSecret - The Secret to use.public GeoApiContext.Builder channel(java.lang.String channel)
channel - The channel to use for analyticspublic GeoApiContext.Builder connectTimeout(long timeout, java.util.concurrent.TimeUnit unit)
timeout - The connect timeout period in units.unit - The connect timeout time unit.URLConnection.setConnectTimeout(int)public GeoApiContext.Builder readTimeout(long timeout, java.util.concurrent.TimeUnit unit)
timeout - The read timeout period in units.unit - The read timeout time unit.URLConnection.setReadTimeout(int)public GeoApiContext.Builder writeTimeout(long timeout, java.util.concurrent.TimeUnit unit)
timeout - The write timeout period in units.unit - The write timeout time unit.public GeoApiContext.Builder retryTimeout(long timeout, java.util.concurrent.TimeUnit unit)
This operates separately from the count-based maxRetries(Integer).
timeout - The retry timeout period in units.unit - The retry timeout time unit.public GeoApiContext.Builder maxRetries(java.lang.Integer maxRetries)
This operates separately from the time-based retryTimeout(long, TimeUnit).
maxRetries - The maximum number of times to retry.public GeoApiContext.Builder disableRetries()
public GeoApiContext.Builder queryRateLimit(int maxQps)
maxQps).maxQps - The maximum queries per second.public GeoApiContext.Builder setIfExceptionIsAllowedToRetry(java.lang.Class<? extends ApiException> exception, boolean allowedToRetry)
exception - The ApiException to allow or deny being re-tried.allowedToRetry - Whether to allow or deny re-trying exception.public GeoApiContext.Builder proxy(java.net.Proxy proxy)
proxy - The proxy to be used by the underlying HTTP client.public GeoApiContext.Builder proxyAuthentication(java.lang.String proxyUserName, java.lang.String proxyUserPassword)
proxyUserName - username for proxy authenticationproxyUserPassword - username for proxy authenticationpublic GeoApiContext build()
GeoApiContext.GeoApiContext.