当前位置: 首页>>代码示例>>Java>>正文


Java AbstractGoogleJsonClient.Builder方法代码示例

本文整理汇总了Java中com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractGoogleJsonClient.Builder方法的具体用法?Java AbstractGoogleJsonClient.Builder怎么用?Java AbstractGoogleJsonClient.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient的用法示例。


在下文中一共展示了AbstractGoogleJsonClient.Builder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareBuilder

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
private <T extends AbstractGoogleJsonClient.Builder> T prepareBuilder(T builder,
    final HttpRequestInitializer delegate,
    GoogleClientRequestInitializer googleClientRequestInitializer) {
  builder
      .setHttpRequestInitializer(getHttpRequestInitializer(delegate))
      .setApplicationName(applicationName)
      .setGoogleClientRequestInitializer(googleClientRequestInitializer);

  if (rootUrl.isPresent()) {
    builder.setRootUrl(rootUrl.get());
  }
  if (servicePath.isPresent()) {
    builder.setServicePath(servicePath.get());
  }
  return builder;
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:17,代码来源:GenomicsFactory.java

示例2: setupLocalApi

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
private void setupLocalApi(AbstractGoogleJsonClient.Builder builder) {
    builder.setApplicationName(appName)
            .setRootUrl(rootUrl)
            .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
                @Override
                public void initialize(AbstractGoogleClientRequest<?> request) throws IOException {
                    request.setDisableGZipContent(true);
                }
            });
}
 
开发者ID:AndrewJack,项目名称:moment-for-android-wear,代码行数:11,代码来源:EndpointModule.java

示例3: updateCredential

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
public static AbstractGoogleJsonClient updateCredential(AbstractGoogleJsonClient.Builder builder, String accountName) {
    GoogleAccountCredential credential = (GoogleAccountCredential) builder.getHttpRequestInitializer();
    String selectedAccountName = credential.getSelectedAccountName();
    if (selectedAccountName == null || !selectedAccountName.equals(accountName)) {
        credential.setSelectedAccountName(accountName);
        builder.setHttpRequestInitializer(credential);
    }
    return builder.build();
}
 
开发者ID:AndrewJack,项目名称:moment-for-android-wear,代码行数:10,代码来源:CredentialUtil.java

示例4: fromClientSecretsFile

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder using a {@code client_secrets.json} {@link File}.
 *
 * @param builder The builder to be prepared.
 * @param clientSecretsJson {@code client_secrets.json} file.
 * @return The passed in builder, for easy chaining.
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromClientSecretsFile(T builder,
    File clientSecretsJson) {
  Preconditions.checkNotNull(builder);
  Preconditions.checkNotNull(clientSecretsJson);
  return prepareBuilder(builder,
      CredentialFactory.getCredentialFromClientSecrets(clientSecretsJson.getAbsolutePath(),
          applicationName),
      null);
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:17,代码来源:GenomicsFactory.java

示例5: fromServiceAccount

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder with the given service account ID
 * and private key {@link File}.
 *
 * @param builder The builder to be prepared.
 * @param serviceAccountId The service account ID (typically an email address)
 * @param p12File The file on disk containing the private key
 * @return The passed in builder, for easy chaining.
 * @throws GeneralSecurityException
 * @throws IOException
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromServiceAccount(T builder,
    String serviceAccountId, File p12File) throws GeneralSecurityException, IOException {
  Preconditions.checkNotNull(builder);
  GoogleCredential creds = new GoogleCredential.Builder()
      .setTransport(httpTransport)
      .setJsonFactory(jsonFactory)
      .setServiceAccountId(serviceAccountId)
      .setServiceAccountScopes(scopes)
      .setServiceAccountPrivateKeyFromP12File(p12File)
      .build();
  creds.refreshToken();
  return prepareBuilder(builder, creds, null);
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:25,代码来源:GenomicsFactory.java

示例6: fromOfflineAuth

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder with the given OfflineAuth object.
 *
 * @param builder The builder to be prepared.
 * @param auth The OfflineAuth
 * @return The passed in builder, for easy chaining.
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromOfflineAuth(T builder, OfflineAuth auth) {
  Preconditions.checkNotNull(builder);
  Preconditions.checkNotNull(auth);
  if(auth.hasApiKey()) {
    return fromApiKey(builder, auth.getApiKey());
  }
  return fromCredential(builder, auth.getCredential());
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:16,代码来源:GenomicsFactory.java

示例7: fromApiKey

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder using an API key.
 *
 * @param builder The builder to be prepared.
 * @param apiKey The API key of the Google Cloud Platform project.
 * @return The passed in builder, for easy chaining.
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromApiKey(T builder, String apiKey) {
  Preconditions.checkNotNull(builder);
  Preconditions.checkNotNull(apiKey);
  return prepareBuilder(builder, null, new CommonGoogleClientRequestInitializer(apiKey));
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:13,代码来源:GenomicsFactory.java

示例8: fromCredential

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder using a credential.
 *
 * @param builder The builder to be prepared.
 * @param credential The credential to be used for requests.
 * @return The passed in builder, for easy chaining.
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromCredential(T builder, Credential credential) {
  Preconditions.checkNotNull(builder);
  Preconditions.checkNotNull(credential);
  return prepareBuilder(builder, credential, null);
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:13,代码来源:GenomicsFactory.java

示例9: fromApplicationDefaultCredential

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; //导入方法依赖的package包/类
/**
 * Prepare an AbstractGoogleJsonClient.Builder using the Application Default Credential.
 *
 * @param builder The builder to be prepared.
 * @return The passed in builder, for easy chaining.
 */
public <T extends AbstractGoogleJsonClient.Builder> T fromApplicationDefaultCredential(T builder) {
  Preconditions.checkNotNull(builder);
  return fromCredential(builder, CredentialFactory.getApplicationDefaultCredential());
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:11,代码来源:GenomicsFactory.java


注:本文中的com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。