类 GeoApiContext.Builder
java.lang.Object
ai.nextbillion.maps.GeoApiContext.Builder
- 封闭类:
- GeoApiContext
public static class GeoApiContext.Builder
extends java.lang.Object
The Builder for
GeoApiContext.-
构造器概要
构造器 构造器 说明 Builder()Builder pattern for the enclosingGeoApiContext.Builder(GeoApiContext.RequestHandler.Builder builder) -
方法概要
修饰符和类型 方法 说明 GeoApiContext.BuilderapiKey(java.lang.String apiKey)Sets the API Key to use for authorizing requests.GeoApiContext.BuilderapiKeyInQuery(boolean apiKeyInQuery)Sets the API Key to use for authorizing requests.GeoApiContextbuild()Converts this builder into aGeoApiContext.GeoApiContext.Builderchannel(java.lang.String channel)Sets the default channel for requests (can be overridden by requests).GeoApiContext.BuilderconnectTimeout(long timeout, java.util.concurrent.TimeUnit unit)Sets the default connect timeout for new connections.GeoApiContext.BuilderdisableRetries()Disables retries completely, by setting max retries to 0 and retry timeout to 0.GeoApiContext.BuilderenterpriseCredentials(java.lang.String clientId, java.lang.String cryptographicSecret)Sets the ClientID/Secret pair to use for authorizing requests.GeoApiContext.BuilderexperienceId(java.lang.String... experienceId)Sets the value for the HTTP header field nameHttpHeaders.X_GOOG_MAPS_EXPERIENCE_IDHTTP header value for the field name on subsequent API calls.GeoApiContext.BuilderhostName(java.lang.String hostName)Overrides the base URL of the API endpoint.GeoApiContext.BuildermaxRetries(java.lang.Integer maxRetries)Sets the maximum number of times each retry-able errors will be retried.GeoApiContext.Builderproxy(java.net.Proxy proxy)Sets the proxy for new connections.GeoApiContext.BuilderproxyAuthentication(java.lang.String proxyUserName, java.lang.String proxyUserPassword)set authentication for proxyGeoApiContext.BuilderqueryRateLimit(int maxQps)Sets the maximum number of queries that will be executed during a 1 second interval.GeoApiContext.BuilderreadTimeout(long timeout, java.util.concurrent.TimeUnit unit)Sets the default read timeout for new connections.GeoApiContext.BuilderrequestHandlerBuilder(GeoApiContext.RequestHandler.Builder builder)Changes the RequestHandler.Builder strategy to change between theOkHttpRequestHandlerand theGaeRequestHandler.GeoApiContext.BuilderrequestMetricsReporter(RequestMetricsReporter requestMetricsReporter)GeoApiContext.BuilderretryTimeout(long timeout, java.util.concurrent.TimeUnit unit)Sets the cumulative time limit for which retry-able errors will be retried.GeoApiContext.BuildersetIfExceptionIsAllowedToRetry(java.lang.Class<? extends ApiException> exception, boolean allowedToRetry)Allows specific API exceptions to be retried or not retried.GeoApiContext.BuilderwriteTimeout(long timeout, java.util.concurrent.TimeUnit unit)Sets the default write timeout for new connections.
-
构造器详细资料
-
方法详细资料
-
requestHandlerBuilder
Changes the RequestHandler.Builder strategy to change between theOkHttpRequestHandlerand theGaeRequestHandler.- 参数:
builder- TheRequestHandler.Builderto use forbuild()- 返回:
- Returns this builder for call chaining.
- 另请参阅:
OkHttpRequestHandler,GaeRequestHandler
-
hostName
Overrides the base URL of the API endpoint. Useful for testing or certain international usage scenarios.- 参数:
hostName- The URL to use, without a trailing slash- 返回:
- Returns this builder for call chaining.
-
apiKey
Sets the API Key to use for authorizing requests.- 参数:
apiKey- The API Key to use.- 返回:
- Returns this builder for call chaining.
-
apiKeyInQuery
Sets the API Key to use for authorizing requests.- 参数:
apiKeyInQuery- apiKeyInQuery- 返回:
- Returns this builder for call chaining.
-
enterpriseCredentials
public GeoApiContext.Builder enterpriseCredentials(java.lang.String clientId, java.lang.String cryptographicSecret)Sets the ClientID/Secret pair to use for authorizing requests. Most users should useapiKey(String)instead.- 参数:
clientId- The Client ID to use.cryptographicSecret- The Secret to use.- 返回:
- Returns this builder for call chaining.
-
channel
Sets the default channel for requests (can be overridden by requests). Only useful for Google Maps for Work clients.- 参数:
channel- The channel to use for analytics- 返回:
- Returns this builder for call chaining.
-
connectTimeout
Sets the default connect timeout for new connections. A value of 0 means no timeout.- 参数:
timeout- The connect timeout period inunits.unit- The connect timeout time unit.- 返回:
- Returns this builder for call chaining.
- 另请参阅:
URLConnection.setConnectTimeout(int)
-
readTimeout
Sets the default read timeout for new connections. A value of 0 means no timeout.- 参数:
timeout- The read timeout period inunits.unit- The read timeout time unit.- 返回:
- Returns this builder for call chaining.
- 另请参阅:
URLConnection.setReadTimeout(int)
-
writeTimeout
Sets the default write timeout for new connections. A value of 0 means no timeout.- 参数:
timeout- The write timeout period inunits.unit- The write timeout time unit.- 返回:
- Returns this builder for call chaining.
-
retryTimeout
Sets the cumulative time limit for which retry-able errors will be retried. Defaults to 60 seconds. Set to zero to retry requests forever.This operates separately from the count-based
maxRetries(Integer).- 参数:
timeout- The retry timeout period inunits.unit- The retry timeout time unit.- 返回:
- Returns this builder for call chaining.
-
maxRetries
Sets the maximum number of times each retry-able errors will be retried. Set this to null to not have a max number. Set this to zero to disable retries.This operates separately from the time-based
retryTimeout(long, TimeUnit).- 参数:
maxRetries- The maximum number of times to retry.- 返回:
- Returns this builder for call chaining.
-
disableRetries
Disables retries completely, by setting max retries to 0 and retry timeout to 0.- 返回:
- Returns this builder for call chaining.
-
queryRateLimit
Sets the maximum number of queries that will be executed during a 1 second interval. The default is 50. A minimum interval between requests will also be enforced, set to 1/(2 *maxQps).- 参数:
maxQps- The maximum queries per second.- 返回:
- Returns this builder for call chaining.
-
setIfExceptionIsAllowedToRetry
public GeoApiContext.Builder setIfExceptionIsAllowedToRetry(java.lang.Class<? extends ApiException> exception, boolean allowedToRetry)Allows specific API exceptions to be retried or not retried.- 参数:
exception- TheApiExceptionto allow or deny being re-tried.allowedToRetry- Whether to allow or deny re-tryingexception.- 返回:
- Returns this builder for call chaining.
-
proxy
Sets the proxy for new connections.- 参数:
proxy- The proxy to be used by the underlying HTTP client.- 返回:
- Returns this builder for call chaining.
-
proxyAuthentication
public GeoApiContext.Builder proxyAuthentication(java.lang.String proxyUserName, java.lang.String proxyUserPassword)set authentication for proxy- 参数:
proxyUserName- username for proxy authenticationproxyUserPassword- username for proxy authentication- 返回:
- Returns this builder for call chaining.
-
experienceId
Sets the value for the HTTP header field nameHttpHeaders.X_GOOG_MAPS_EXPERIENCE_IDHTTP header value for the field name on subsequent API calls.- 参数:
experienceId- The experience ID- 返回:
- Returns this builder for call chaining.
-
requestMetricsReporter
-
build
Converts this builder into aGeoApiContext.- 返回:
- Returns the built
GeoApiContext.
-