software.amazon.awssdk.utils.Validate.notNull()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中software.amazon.awssdk.utils.Validate.notNull()方法的一些代码示例,展示了Validate.notNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.notNull()方法的具体详情如下:
包路径:software.amazon.awssdk.utils.Validate
类名称:Validate
方法名:notNull

Validate.notNull介绍

[英]Validate that the specified argument is not null; otherwise throwing an exception with the specified message.

Validate.notNull(myObject, "The object must not be null");

[中]验证指定的参数不为null;否则,将使用指定的消息引发异常。

Validate.notNull(myObject, "The object must not be null");

代码示例

代码示例来源:origin: software.amazon.awssdk/sts

/**
 * @see #builder()
 */
private StsAssumeRoleWithSamlCredentialsProvider(Builder builder) {
  super(builder, "sts-assume-role-with-saml-credentials-provider");
  Validate.notNull(builder.assumeRoleWithSamlRequestSupplier, "Assume role with SAML request must not be null.");
  this.assumeRoleWithSamlRequestSupplier = builder.assumeRoleWithSamlRequestSupplier;
}

代码示例来源:origin: software.amazon.awssdk/aws-http-client-apache

ApacheHttpClient(ConnectionManagerAwareHttpClient httpClient,
         ApacheHttpRequestConfig requestConfig,
         AttributeMap resolvedOptions) {
  this.httpClient = notNull(httpClient, "httpClient must not be null.");
  this.requestConfig = notNull(requestConfig, "requestConfig must not be null.");
  this.resolvedOptions = notNull(resolvedOptions, "resolvedOptions must not be null");
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * @see #builder()
 */
private StsAssumeRoleCredentialsProvider(Builder builder) {
  super(builder, "sts-assume-role-credentials-provider");
  Validate.notNull(builder.assumeRoleRequestSupplier, "Assume role request must not be null.");
  this.assumeRoleRequestSupplier = builder.assumeRoleRequestSupplier;
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * @see #builder()
 */
private StsGetFederationTokenCredentialsProvider(Builder builder) {
  super(builder, "sts-get-federation-token-credentials-provider");
  Validate.notNull(builder.getFederationTokenRequest, "Get session token request must not be null.");
  this.getFederationTokenRequest = builder.getFederationTokenRequest;
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * @see #builder()
 */
private StsGetSessionTokenCredentialsProvider(Builder builder) {
  super(builder, "sts-get-token-credentials-provider");
  Validate.notNull(builder.getSessionTokenRequest, "Get session token request must not be null.");
  this.getSessionTokenRequest = builder.getSessionTokenRequest;
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * @see #builder()
 */
private StsAssumeRoleWithWebIdentityCredentialsProvider(Builder builder) {
  super(builder, "sts-assume-role-with-web-identity-credentials-provider");
  Validate.notNull(builder.assumeRoleWithWebIdentityRequest, "Assume role with web identity request must not be null.");
  this.assumeRoleWithWebIdentityRequest = builder.assumeRoleWithWebIdentityRequest;
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * @see #builder()
 */
private StsAssumeRoleWithSamlCredentialsProvider(Builder builder) {
  super(builder, "sts-assume-role-with-saml-credentials-provider");
  Validate.notNull(builder.assumeRoleWithSamlRequestSupplier, "Assume role with SAML request must not be null.");
  this.assumeRoleWithSamlRequestSupplier = builder.assumeRoleWithSamlRequestSupplier;
}

代码示例来源:origin: software.amazon.awssdk/sdk-core

/**
   * Validate that the customer set the provided field.
   */
  protected static <U> U require(String field, U required) {
    return Validate.notNull(required, "The '%s' must be configured in the client builder.", field);
  }
}

代码示例来源:origin: software.amazon.awssdk/sts

/**
 * @see #builder()
 */
private StsAssumeRoleWithWebIdentityCredentialsProvider(Builder builder) {
  super(builder, "sts-assume-role-with-web-identity-credentials-provider");
  Validate.notNull(builder.assumeRoleWithWebIdentityRequest, "Assume role with web identity request must not be null.");
  this.assumeRoleWithWebIdentityRequest = builder.assumeRoleWithWebIdentityRequest;
}

代码示例来源:origin: aws/aws-sdk-java-v2

private StaticCredentialsProvider(AwsCredentials credentials) {
  this.credentials = Validate.notNull(credentials, "Credentials must not be null.");
}

代码示例来源:origin: software.amazon.awssdk/utils

/**
 * Add a mapping between the provided key and value.
 */
public <T> Builder put(Key<T> key, T value) {
  Validate.notNull(key, "Key to set must not be null.");
  configuration.put(key, value);
  return this;
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * Add a mapping between the provided key and value.
 */
public <T> Builder put(Key<T> key, T value) {
  Validate.notNull(key, "Key to set must not be null.");
  configuration.put(key, value);
  return this;
}

代码示例来源:origin: aws/aws-sdk-java-v2

private AwsBasicCredentials(String accessKeyId, String secretAccessKey, boolean validateCredentials) {
  this.accessKeyId = trimToNull(accessKeyId);
  this.secretAccessKey = trimToNull(secretAccessKey);
  if (validateCredentials) {
    Validate.notNull(this.accessKeyId, "Access key ID cannot be blank.");
    Validate.notNull(this.secretAccessKey, "Secret access key cannot be blank.");
  }
}

代码示例来源:origin: aws/aws-sdk-java-v2

/**
 * Get the value associated with the provided key from this map. This will return null if the value is not set or if the
 * value
 * stored is null. These cases can be disambiguated using {@link #containsKey(Key)}.
 */
public <T> T get(Key<T> key) {
  Validate.notNull(key, "Key to retrieve must not be null.");
  return key.convertValue(attributes.get(key));
}

代码示例来源:origin: software.amazon.awssdk/utils

/**
 * Get the value associated with the provided key from this map. This will return null if the value is not set or if the
 * value
 * stored is null. These cases can be disambiguated using {@link #containsKey(Key)}.
 */
public <T> T get(Key<T> key) {
  Validate.notNull(key, "Key to retrieve must not be null.");
  return key.convertValue(attributes.get(key));
}

代码示例来源:origin: aws/aws-sdk-java-v2

@Override
protected Credentials getUpdatedCredentials(StsClient stsClient) {
  AssumeRoleRequest assumeRoleRequest = assumeRoleRequestSupplier.get();
  Validate.notNull(assumeRoleRequest, "Assume role request must not be null.");
  return stsClient.assumeRole(assumeRoleRequest).credentials();
}

代码示例来源:origin: aws/aws-sdk-java-v2

@Override
protected Credentials getUpdatedCredentials(StsClient stsClient) {
  AssumeRoleWithSamlRequest assumeRoleWithSamlRequest = assumeRoleWithSamlRequestSupplier.get();
  Validate.notNull(assumeRoleWithSamlRequest, "Assume role with saml request must not be null.");
  return stsClient.assumeRoleWithSAML(assumeRoleWithSamlRequest).credentials();
}

代码示例来源:origin: software.amazon.awssdk/sts

@Override
protected Credentials getUpdatedCredentials(StsClient stsClient) {
  AssumeRoleRequest assumeRoleRequest = assumeRoleRequestSupplier.get();
  Validate.notNull(assumeRoleRequest, "Assume role request must not be null.");
  return stsClient.assumeRole(assumeRoleRequest).credentials();
}

代码示例来源:origin: aws/aws-sdk-java-v2

protected StsCredentialsProvider(BaseBuilder<?, ?> builder, String asyncThreadName) {
  this.stsClient = Validate.notNull(builder.stsClient, "STS client must not be null.");
  CachedSupplier.Builder<SessionCredentialsHolder> cacheBuilder = CachedSupplier.builder(this::updateSessionCredentials);
  if (builder.asyncCredentialUpdateEnabled) {
    cacheBuilder.prefetchStrategy(new NonBlocking(asyncThreadName));
  }
  this.sessionCache = cacheBuilder.build();
}

代码示例来源:origin: software.amazon.awssdk/sts

protected StsCredentialsProvider(BaseBuilder<?, ?> builder, String asyncThreadName) {
  this.stsClient = Validate.notNull(builder.stsClient, "STS client must not be null.");
  CachedSupplier.Builder<SessionCredentialsHolder> cacheBuilder = CachedSupplier.builder(this::updateSessionCredentials);
  if (builder.asyncCredentialUpdateEnabled) {
    cacheBuilder.prefetchStrategy(new NonBlocking(asyncThreadName));
  }
  this.sessionCache = cacheBuilder.build();
}

相关文章