Source:
<code>public Client build() { if (!this.clientConfig.isCacheManagerEnabled()) { log.debug("CacheManager disabled. Defaulting to DisabledCacheManager"); this.cacheManager = Caches.newDisabledCacheManager(); } else if (this.cacheManager == null) { log.debug("No CacheManager configured. Defaulting to in-memory CacheManager with default TTL and TTI of five minutes."); CacheManagerBuilder cacheManagerBuilder = Caches.newCacheManager() .withDefaultTimeToIdle(this.clientConfig.getCacheManagerTti(), TimeUnit.SECONDS) .withDefaultTimeToLive(this.clientConfig.getCacheManagerTtl(), TimeUnit.SECONDS); if (this.clientConfig.getCacheManagerCaches().size() > 0) { for (CacheConfigurationBuilder builder : this.clientConfig.getCacheManagerCaches().values()) { cacheManagerBuilder.withCache(builder); } } this.cacheManager = cacheManagerBuilder.build(); } if (this.clientConfig.getClientCredentialsResolver() == null && this.clientCredentials != null) { this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(this.clientCredentials)); } else if (this.clientConfig.getClientCredentialsResolver() == null) { this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(clientConfig)); } if (this.clientConfig.getBaseUrlResolver() == null) { ConfigurationValidator.assertOrgUrl(this.clientConfig.getBaseUrl(), allowNonHttpsForTesting); this.clientConfig.setBaseUrlResolver(new DefaultBaseUrlResolver(this.clientConfig.getBaseUrl())); } <START> if (this.clientConfig.getAuthenticationScheme() == AuthenticationScheme.OAUTH2) { <END> accessTokenRetrieverService = new AccessTokenRetrieverServiceImpl(this.clientConfig); OAuth2ClientCredentials oAuth2ClientCredentials = new OAuth2ClientCredentials(accessTokenRetrieverService); OAuth2ClientCredentialsResolver oAuth2ClientCredentialsResolver = new OAuth2ClientCredentialsResolver(oAuth2ClientCredentials); this.clientConfig.setClientCredentialsResolver(oAuth2ClientCredentialsResolver); } return new DefaultClient(clientConfig, cacheManager); }</code><technical_language>do need AuthenticationScheme AuthorizationMode determine if retrieve access token</technical_language>

Target:
public Client build() { if (!this.clientConfig.isCacheManagerEnabled()) { log.debug("CacheManager disabled. Defaulting to DisabledCacheManager"); this.cacheManager = Caches.newDisabledCacheManager(); } else if (this.cacheManager == null) { log.debug("No CacheManager configured. Defaulting to in-memory CacheManager with default TTL and TTI of five minutes."); CacheManagerBuilder cacheManagerBuilder = Caches.newCacheManager() .withDefaultTimeToIdle(this.clientConfig.getCacheManagerTti(), TimeUnit.SECONDS) .withDefaultTimeToLive(this.clientConfig.getCacheManagerTtl(), TimeUnit.SECONDS); if (this.clientConfig.getCacheManagerCaches().size() > 0) { for (CacheConfigurationBuilder builder : this.clientConfig.getCacheManagerCaches().values()) { cacheManagerBuilder.withCache(builder); } } this.cacheManager = cacheManagerBuilder.build(); } if (this.clientConfig.getBaseUrlResolver() == null) { ConfigurationValidator.assertOrgUrl(this.clientConfig.getBaseUrl(), allowNonHttpsForTesting); this.clientConfig.setBaseUrlResolver(new DefaultBaseUrlResolver(this.clientConfig.getBaseUrl())); } if (!isOAuth2Flow()) { if (this.clientConfig.getClientCredentialsResolver() == null && this.clientCredentials != null) { this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(this.clientCredentials)); } else if (this.clientConfig.getClientCredentialsResolver() == null) { this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(this.clientConfig)); } } else { this.clientConfig.setAuthenticationScheme(AuthenticationScheme.OAUTH2_PRIVATE_KEY); validateOAuth2ClientConfig(this.clientConfig); accessTokenRetrieverService = new AccessTokenRetrieverServiceImpl(clientConfig); OAuth2ClientCredentials oAuth2ClientCredentials = new OAuth2ClientCredentials(accessTokenRetrieverService); this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(oAuth2ClientCredentials)); } return new DefaultClient(clientConfig, cacheManager); }