/** * Sets the service authentication credentials. If no credentials are set, {@link * GoogleCredentials#getApplicationDefault()} will be used to attempt getting credentials from * the environment. Use {@link NoCredentials#getInstance()} to skip authentication, this is * typically useful when using local service emulators. * * @param credentials authentication credentials, should not be {@code null} * @return the builder * @throws NullPointerException if {@code credentials} is {@code null}. To disable * authentication use {@link NoCredentials#getInstance()} */ public B setCredentials(Credentials credentials) { this.credentials = checkNotNull(credentials); // set project id if available if (this.projectId == null && credentials instanceof ServiceAccountCredentials) { this.projectId = ((ServiceAccountCredentials) credentials).getProjectId(); } return self(); }
/** * Sets service host. * * @return the builder */ public B host(String host) { this.host = host; return self(); }
/** * Sets the transport options. * * @return the builder */ public B setTransportOptions(TransportOptions transportOptions) { this.transportOptions = transportOptions; return self(); }
/** * Sets the factory for rpc services. * * @return the builder */ public B setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory) { this.serviceRpcFactory = serviceRpcFactory; return self(); }
/** * Sets the project ID. If no project ID is set, {@link #getDefaultProjectId()} will be used to * attempt getting the project ID from the environment. * * @return the builder */ public B setProjectId(String projectId) { this.projectId = projectId; return self(); }
/** Sets the service factory. */ public B setServiceFactory(ServiceFactory<ServiceT, OptionsT> serviceFactory) { this.serviceFactory = serviceFactory; return self(); }
/** * Sets configuration parameters for request retries. * * @return the builder */ public B setRetrySettings(RetrySettings retrySettings) { this.retrySettings = retrySettings; return self(); }
/** * Sets the service's clock. The clock is mainly used for testing purpose. {@link ApiClock} will * be replaced by Java8's {@code java.time.Clock}. * * @param clock the clock to set * @return the builder */ public B setClock(ApiClock clock) { this.clock = clock; return self(); }
/** * Sets the service authentication credentials. * * @return the builder */ public B authCredentials(AuthCredentials authCredentials) { this.authCredentials = authCredentials; return self(); }
/** * Sets project id. * * @return the builder */ public B projectId(String projectId) { this.projectId = projectId; return self(); }
/** * Sets the service factory. */ public B serviceFactory(ServiceFactory<ServiceT, OptionsT> serviceFactory) { this.serviceFactory = serviceFactory; return self(); }
/** * Sets service host. * * @return the builder */ public B setHost(String host) { this.host = host; return self(); }
/** * Sets the static header provider. The header provider will be called during client * construction only once. The headers returned by the provider will be cached and supplied as * is for each request issued by the constructed client. Some reserved headers can be overridden * (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying * transport layer. * * @param headerProvider the header provider * @return the builder */ @BetaApi public B setHeaderProvider(HeaderProvider headerProvider) { this.headerProvider = headerProvider; return self(); } }
/** * Sets service host. * * @return the builder */ public B setHost(String host) { this.host = host; return self(); }
/** * Sets the service's clock. The clock is mainly used for testing purpose. {@link ApiClock} will * be replaced by Java8's {@code java.time.Clock}. * * @param clock the clock to set * @return the builder */ public B setClock(ApiClock clock) { this.clock = clock; return self(); }
/** Sets the service factory. */ public B setServiceFactory(ServiceFactory<ServiceT, OptionsT> serviceFactory) { this.serviceFactory = serviceFactory; return self(); }
/** * Sets the transport options. * * @return the builder */ public B setTransportOptions(TransportOptions transportOptions) { this.transportOptions = transportOptions; return self(); }
/** * Sets the factory for rpc services. * * @return the builder */ public B setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory) { this.serviceRpcFactory = serviceRpcFactory; return self(); }
/** * Sets configuration parameters for request retries. * * @return the builder */ public B setRetrySettings(RetrySettings retrySettings) { this.retrySettings = retrySettings; return self(); }
/** * Sets the project ID. If no project ID is set, {@link #getDefaultProjectId()} will be used to * attempt getting the project ID from the environment. * * @return the builder */ public B setProjectId(String projectId) { this.projectId = projectId; return self(); }