java.lang.String.isBlank()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(285)

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

String.isBlank介绍

暂无

代码示例

代码示例来源:origin: com.yahoo.vespa/config-provisioning

private static String requireNonBlank(String s, String message) {
  if (s == null || s.isBlank()) {
    throw new IllegalArgumentException(message);
  }
  return s;
}

代码示例来源:origin: io.github.udaychandra/common

public MetadataItem(Class<?> serviceProvider, Metadata holder) {
  providerName = serviceProvider.getName();
  activateMethodName = holder.properties().getProperty(providerName + ACTIVATE_SUFFIX);
  var refs = holder.properties().getProperty(providerName + REFS_SUFFIX);
  if (refs != null && !refs.isBlank()) {
    var tokens = refs.split(COMMA);
    references = new ArrayList<>(tokens.length);
    for (String t : tokens) {
      references.add(new Reference(t, holder.module().getLayer()));
    }
  } else {
    references = List.of();
  }
}

代码示例来源:origin: no.ssb.lds/linked-data-store-persistence-provider-foundationdb

@Override
public JsonPersistence initialize(String defaultNamespace, Map<String, String> configuration, Set<String> managedDomains) {
  FDB fdb = FDB.selectAPIVersion(520);
  Database db = fdb.open();
  String nodePrefixHex = configuration.get("foundationdb.directory.node-prefix.hex");
  if (nodePrefixHex == null || nodePrefixHex.isBlank()) {
    nodePrefixHex = "0x23"; // default
  }
  String contentPrefixHex = configuration.get("foundationdb.directory.content-prefix.hex");
  if (contentPrefixHex == null || contentPrefixHex.isBlank()) {
    contentPrefixHex = "0x24";  // default
  }
  int fragmentCapacityBytes = Integer.parseInt(ofNullable(configuration.get("persistence.fragment.capacity")).orElse("8192"));
  byte[] nodePrefix = hexToBytes(nodePrefixHex);
  byte[] contentPrefix = hexToBytes(contentPrefixHex);
  Directory directory = new DirectoryLayer(new Subspace(nodePrefix), new Subspace(contentPrefix));
  FoundationDBPersistence persistence = new FoundationDBPersistence(new FoundationDBTransactionFactory(db), new DefaultFoundationDBDirectory(db, directory));
  return new BufferedJsonPersistence(new DefaultFlattenedPersistence(persistence, fragmentCapacityBytes), fragmentCapacityBytes);
}

相关文章