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

x33g5p2x  于2022-01-18 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(101)

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

CollectionUtils.isNullOrEmpty介绍

暂无

代码示例

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

/**
   * Returns a boolean value indicating if the information present in this object
   * is sufficient to generate the paginated APIs.
   *
   * @return True if all necessary information to generate paginator APIs is present. Otherwise false.
   */
  public boolean isValid() {
    Pattern p = Pattern.compile(VALID_REGEX);

    return !CollectionUtils.isNullOrEmpty(inputToken) &&
        !CollectionUtils.isNullOrEmpty(outputToken) &&
        outputToken.stream().allMatch(t -> p.matcher(t).matches());
  }
}

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

/**
   * Returns a boolean value indicating if the information present in this object
   * is sufficient to generate the paginated APIs.
   *
   * @return True if all necessary information to generate paginator APIs is present. Otherwise false.
   */
  public boolean isValid() {
    Pattern p = Pattern.compile(VALID_REGEX);

    return !CollectionUtils.isNullOrEmpty(inputToken) &&
        !CollectionUtils.isNullOrEmpty(outputToken) &&
        outputToken.stream().allMatch(t -> p.matcher(t).matches());
  }
}

代码示例来源:origin: awslabs/amazon-kinesis-client

/** Helper method to detect a race condition between fetching the shards via paginated DescribeStream calls
 * and a reshard operation.
 * @param inconsistentShardIds
 * @throws KinesisClientLibIOException
 */
private static void assertAllParentShardsAreClosed(final Set<String> inconsistentShardIds)
  throws KinesisClientLibIOException {
  if (!CollectionUtils.isNullOrEmpty(inconsistentShardIds)) {
    final String ids = StringUtils.join(inconsistentShardIds, ' ');
    throw new KinesisClientLibIOException(String.format(
        "%d open child shards (%s) are inconsistent. This can happen due to a race condition between describeStream and a reshard operation.",
        inconsistentShardIds.size(), ids));
  }
}

代码示例来源:origin: software.amazon.kinesis/amazon-kinesis-client

/** Helper method to detect a race condition between fetching the shards via paginated DescribeStream calls
 * and a reshard operation.
 * @param inconsistentShardIds
 * @throws KinesisClientLibIOException
 */
private static void assertAllParentShardsAreClosed(final Set<String> inconsistentShardIds)
  throws KinesisClientLibIOException {
  if (!CollectionUtils.isNullOrEmpty(inconsistentShardIds)) {
    final String ids = StringUtils.join(inconsistentShardIds, ' ');
    throw new KinesisClientLibIOException(String.format(
        "%d open child shards (%s) are inconsistent. This can happen due to a race condition between describeStream and a reshard operation.",
        inconsistentShardIds.size(), ids));
  }
}

代码示例来源:origin: awslabs/amazon-kinesis-client

@Override
public Shard shard(@NonNull final String shardId) {
  if (CollectionUtils.isNullOrEmpty(this.cachedShardMap)) {
    synchronized (this) {
      if (CollectionUtils.isNullOrEmpty(this.cachedShardMap)) {
        listShards();

代码示例来源:origin: software.amazon.kinesis/amazon-kinesis-client

@Override
public Shard shard(@NonNull final String shardId) {
  if (CollectionUtils.isNullOrEmpty(this.cachedShardMap)) {
    synchronized (this) {
      if (CollectionUtils.isNullOrEmpty(this.cachedShardMap)) {
        listShards();

代码示例来源:origin: awslabs/amazon-kinesis-client

.collect(Collectors.toSet());
if (!CollectionUtils.isNullOrEmpty(leasesOfClosedShards)) {
  assertClosedShardsAreCoveredOrAbsent(shardIdToShardMap, shardIdToChildShardIdsMap, shardIdsOfClosedShards);
  Comparator<? super Lease> startingSequenceNumberComparator = new StartingSequenceNumberAndShardIdBasedComparator(
    final String closedShardId = leaseOfClosedShard.leaseKey();
    final Set<String> childShardIds = shardIdToChildShardIdsMap.get(closedShardId);
    if (closedShardId != null && !CollectionUtils.isNullOrEmpty(childShardIds)) {
      cleanupLeaseForClosedShard(closedShardId, childShardIds, trackedLeaseMap, leaseRefresher);

代码示例来源:origin: software.amazon.kinesis/amazon-kinesis-client

.filter(lease -> isCandidateForCleanup(lease, kinesisShards)).collect(Collectors.toList());
if (!CollectionUtils.isNullOrEmpty(garbageLeases)) {
  log.info("Found {} candidate leases for cleanup. Refreshing list of" 
      + " Kinesis shards to pick up recent/latest shards", garbageLeases.size());

代码示例来源:origin: awslabs/amazon-kinesis-client

.filter(lease -> isCandidateForCleanup(lease, kinesisShards)).collect(Collectors.toList());
if (!CollectionUtils.isNullOrEmpty(garbageLeases)) {
  log.info("Found {} candidate leases for cleanup. Refreshing list of" 
      + " Kinesis shards to pick up recent/latest shards", garbageLeases.size());

代码示例来源:origin: software.amazon.kinesis/amazon-kinesis-client

.collect(Collectors.toSet());
if (!CollectionUtils.isNullOrEmpty(leasesOfClosedShards)) {
  assertClosedShardsAreCoveredOrAbsent(shardIdToShardMap, shardIdToChildShardIdsMap, shardIdsOfClosedShards);
  Comparator<? super Lease> startingSequenceNumberComparator = new StartingSequenceNumberAndShardIdBasedComparator(
    final String closedShardId = leaseOfClosedShard.leaseKey();
    final Set<String> childShardIds = shardIdToChildShardIdsMap.get(closedShardId);
    if (closedShardId != null && !CollectionUtils.isNullOrEmpty(childShardIds)) {
      cleanupLeaseForClosedShard(closedShardId, childShardIds, trackedLeaseMap, leaseRefresher);

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

private boolean shouldPutParamsInBody(SdkHttpFullRequest.Builder input) {
  return input.method() == SdkHttpMethod.POST &&
      input.contentStreamProvider() == null &&
      !CollectionUtils.isNullOrEmpty(input.rawQueryParameters());
}

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

public ResponseMetadataSpec(IntermediateModel model) {
  if (!CollectionUtils.isNullOrEmpty(model.getCustomizationConfig().getCustomResponseMetadata())) {
    this.headerMetadata.putAll(model.getCustomizationConfig().getCustomResponseMetadata());
  }
  this.poetExtensions = new PoetExtensions(model);
}

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

public ResponseMetadataSpec(IntermediateModel model) {
  if (!CollectionUtils.isNullOrEmpty(model.getCustomizationConfig().getCustomResponseMetadata())) {
    this.headerMetadata.putAll(model.getCustomizationConfig().getCustomResponseMetadata());
  }
  this.poetExtensions = new PoetExtensions(model);
}

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

private void setSimpleMethods(IntermediateModel model) {
  CustomizationConfig config = model.getCustomizationConfig();
  model.getOperations().values().forEach(operation -> {
    ShapeModel inputShape = operation.getInputShape();
    String methodName = operation.getMethodName();
    if (config.getVerifiedSimpleMethods().contains(methodName)) {
      inputShape.setSimpleMethod(true);
    } else {
      inputShape.setSimpleMethod(false);
      boolean methodIsNotBlacklisted = !config.getBlacklistedSimpleMethods().contains(methodName) ||
                       config.getBlacklistedSimpleMethods().stream().noneMatch(m -> m.equals("*"));
      boolean methodHasNoRequiredMembers = !CollectionUtils.isNullOrEmpty(inputShape.getRequired());
      boolean methodIsNotStreaming = !operation.isStreaming();
      boolean methodHasSimpleMethodVerb = methodName.matches(Constant.APPROVED_SIMPLE_METHOD_VERBS);
      if (methodIsNotBlacklisted && methodHasNoRequiredMembers && methodIsNotStreaming && methodHasSimpleMethodVerb) {
        log.warn("A potential simple method exists that isn't whitelisted or blacklisted: " + methodName);
      }
    }
  });
}

代码示例来源:origin: awslabs/amazon-kinesis-client

if (CollectionUtils.isNullOrEmpty(dynamoRecord)) {
  log.debug("No lease found with key {}, returning null.", leaseKey);
  return null;

代码示例来源:origin: software.amazon.kinesis/amazon-kinesis-client

if (CollectionUtils.isNullOrEmpty(dynamoRecord)) {
  log.debug("No lease found with key {}, returning null.", leaseKey);
  return null;

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

private SdkPojo unmarshall(QueryUnmarshallerContext context, SdkPojo sdkPojo, XmlElement root) {
  if (root != null) {
    for (SdkField<?> field : sdkPojo.sdkFields()) {
      List<XmlElement> element = root.getElementsByName(field.unmarshallLocationName());
      if (!CollectionUtils.isNullOrEmpty(element)) {
        QueryUnmarshaller<Object> unmarshaller =
          UNMARSHALLER_REGISTRY.getUnmarshaller(field.location(), field.marshallingType());
        Object unmarshalled = unmarshaller.unmarshall(context, element, (SdkField<Object>) field);
        field.set(sdkPojo, unmarshalled);
      }
    }
  }
  return (SdkPojo) ((Buildable) sdkPojo).build();
}

代码示例来源:origin: software.amazon.awssdk/aws-query-protocol

private SdkPojo unmarshall(QueryUnmarshallerContext context, SdkPojo sdkPojo, XmlElement root) {
  if (root != null) {
    for (SdkField<?> field : sdkPojo.sdkFields()) {
      List<XmlElement> element = root.getElementsByName(field.unmarshallLocationName());
      if (!CollectionUtils.isNullOrEmpty(element)) {
        QueryUnmarshaller<Object> unmarshaller =
          UNMARSHALLER_REGISTRY.getUnmarshaller(field.location(), field.marshallingType());
        Object unmarshalled = unmarshaller.unmarshall(context, element, (SdkField<Object>) field);
        field.set(sdkPojo, unmarshalled);
      }
    }
  }
  return (SdkPojo) ((Buildable) sdkPojo).build();
}

代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol

SdkPojo unmarshall(XmlUnmarshallerContext context, SdkPojo sdkPojo, XmlElement root) {
  for (SdkField<?> field : sdkPojo.sdkFields()) {
    XmlUnmarshaller<Object> unmarshaller = REGISTRY.getUnmarshaller(field.location(), field.marshallingType());
    if (root != null && field.location() == MarshallLocation.PAYLOAD) {
      List<XmlElement> element = isExplicitPayloadMember(field) ?
                    singletonList(root) :
                    root.getElementsByName(field.unmarshallLocationName());
      if (!CollectionUtils.isNullOrEmpty(element)) {
        Object unmarshalled = unmarshaller.unmarshall(context, element, (SdkField<Object>) field);
        field.set(sdkPojo, unmarshalled);
      }
    } else {
      Object unmarshalled = unmarshaller.unmarshall(context, null, (SdkField<Object>) field);
      field.set(sdkPojo, unmarshalled);
    }
  }
  return (SdkPojo) ((Buildable) sdkPojo).build();
}

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

SdkPojo unmarshall(XmlUnmarshallerContext context, SdkPojo sdkPojo, XmlElement root) {
  for (SdkField<?> field : sdkPojo.sdkFields()) {
    XmlUnmarshaller<Object> unmarshaller = REGISTRY.getUnmarshaller(field.location(), field.marshallingType());
    if (root != null && field.location() == MarshallLocation.PAYLOAD) {
      List<XmlElement> element = isExplicitPayloadMember(field) ?
                    singletonList(root) :
                    root.getElementsByName(field.unmarshallLocationName());
      if (!CollectionUtils.isNullOrEmpty(element)) {
        Object unmarshalled = unmarshaller.unmarshall(context, element, (SdkField<Object>) field);
        field.set(sdkPojo, unmarshalled);
      }
    } else {
      Object unmarshalled = unmarshaller.unmarshall(context, null, (SdkField<Object>) field);
      field.set(sdkPojo, unmarshalled);
    }
  }
  return (SdkPojo) ((Buildable) sdkPojo).build();
}

相关文章