Class ServiceOptions.Builder<ServiceT,OptionsT,B> (2.58.2) 
  
      
     
  
  
  
   
  
    
  
  
    
    
    
  Version 2.58.2keyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   abstract   static   class  ServiceOptions . Builder<ServiceT , OptionsT , B > 
   
  Builder for ServiceOptions.
 
  
  
  
    
      
        Type Parameters  
       
      
        Name  
        Description  
       
      
        ServiceT 
         
       
      
        OptionsT 
         
       
      
        B 
         
       
     
  
  Constructors
   
   
  Builder() 
  
  
Internal Only : This feature is not stable for application use.
This class should only be extended within google-cloud-java 
 
 
   
  Builder(ServiceOptions<ServiceT,OptionsT> options) 
  
    
protected   Builder ( ServiceOptions<ServiceT , OptionsT >  options )  
   
  
Internal Only : This feature is not stable for application use.
This class should only be extended within google-cloud-java 
 
 
  
  Fields
   
  credentials 
  
    
protected   Credentials   credentials  
   
  
    
      
        Field Value  
       
      
        Type  
        Description  
       
      
        com.google.auth.Credentials  
         
       
     
  
  Methods
   
   
  build() 
  
    
protected   abstract   ServiceOptions<ServiceT , OptionsT >  build ()  
   
  
   
  getAllowedClientLibTokens() 
  
    
protected   Set<String>   getAllowedClientLibTokens ()  
   
  
   
  self() 
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
   
  setApiTracerFactory(ApiTracerFactory apiTracerFactory) 
  
    
public   B   setApiTracerFactory ( ApiTracerFactory   apiTracerFactory )  
   
  
Beta 
This feature is covered by the Pre-GA Offerings Terms  of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
 
Sets the ApiTracerFactory . It will be used to create an ApiTracer  that is
 annotated throughout the lifecycle of an RPC operation.
 
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
   
  setClientLibToken(String clientLibToken) 
  
    
public   B   setClientLibToken ( String   clientLibToken )  
   
  
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        clientLibToken 
        String  
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
   
  setClock(ApiClock clock) 
  
    
public   B   setClock ( ApiClock   clock )  
   
  Sets the service's clock. The clock is mainly used for testing purpose. ApiClock  will
 be replaced by Java8's java.time.Clock.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        clock 
        ApiClock the clock to set
 
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setCredentials(Credentials credentials) 
  
    
public   B   setCredentials ( Credentials   credentials )  
   
  Sets the service authentication credentials. If no credentials are set, GoogleCredentials#getApplicationDefault()  will be used to attempt getting credentials from
 the environment. Use NoCredentials#getInstance()  to skip authentication, this is
 typically useful when using local service emulators.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        credentials 
        com.google.auth.Credentials authentication credentials, should not be null
 
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
  
  
  
    
public   B   setHeaderProvider ( HeaderProvider   headerProvider )  
   
  
Beta 
This feature is covered by the Pre-GA Offerings Terms  of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
 
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.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        headerProvider 
        HeaderProvider the header provider
 
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setHost(String host) 
  
    
public   B   setHost ( String   host )  
   
  
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        host 
        String  
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setProjectId(String projectId) 
  
    
public   B   setProjectId ( String   projectId )  
   
  Sets the project ID. If no project ID is set, #getDefaultProjectId()  will be used to
 attempt getting the project ID from the environment.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        projectId 
        String  
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setQuotaProjectId(String quotaProjectId) 
  
    
public   B   setQuotaProjectId ( String   quotaProjectId )  
   
  
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        quotaProjectId 
        String  
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
   
  setRetrySettings(RetrySettings retrySettings) 
  
    
public   B   setRetrySettings ( RetrySettings   retrySettings )  
   
  Sets configuration parameters for request retries.
 
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setServiceFactory(ServiceFactory<ServiceT,OptionsT> serviceFactory) 
  
    
public   B   setServiceFactory ( ServiceFactory<ServiceT , OptionsT >  serviceFactory )  
   
  Sets the service factory.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        serviceFactory 
        ServiceFactory <ServiceT ,OptionsT > 
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
   
  setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory) 
  
    
public   B   setServiceRpcFactory ( ServiceRpcFactory<OptionsT>   serviceRpcFactory )  
   
  Sets the factory for rpc services.
 
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setTransportOptions(TransportOptions transportOptions) 
  
    
public   B   setTransportOptions ( TransportOptions   transportOptions )  
   
  Sets the transport options.
 
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
        the builder
 
       
     
  
   
  setUniverseDomain(String universeDomain) 
  
    
public   B   setUniverseDomain ( String   universeDomain )  
   
  Universe Domain is the domain for Google Cloud Services. A Google Cloud endpoint follows the
 format of {ServiceName}.{UniverseDomain}. For example, speech.googleapis.com would have a
 Universe Domain value of googleapis.com and cloudasset.test.com would have a Universe
 Domain of test.com.
 
If this value is not set, the resolved UniverseDomain will default to googleapis.com.
 
  
    
      
        Parameter  
       
      
        Name  
        Description  
       
      
        universeDomain 
        String  
       
     
  
  
    
      
        Returns  
       
      
        Type  
        Description  
       
      
        B  
         
       
     
  
 
     
    
  
  
  
     
  
 
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-30 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-30 UTC."],[],[]]