org.apache.commons.lang3.StringUtils.isAnyEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(147)

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

StringUtils.isAnyEmpty介绍

[英]Checks if any of the CharSequences are empty ("") or null.

StringUtils.isAnyEmpty((String) null)    = true 
StringUtils.isAnyEmpty((String[]) null)  = false 
StringUtils.isAnyEmpty(null, "foo")      = true 
StringUtils.isAnyEmpty("", "bar")        = true 
StringUtils.isAnyEmpty("bob", "")        = true 
StringUtils.isAnyEmpty("  bob  ", null)  = true 
StringUtils.isAnyEmpty(" ", "bar")       = false 
StringUtils.isAnyEmpty("foo", "bar")     = false 
StringUtils.isAnyEmpty(new String[]{})   = false 
StringUtils.isAnyEmpty(new String[]{""}) = true

[中]检查任何字符序列是否为空(“”)或null。

StringUtils.isAnyEmpty((String) null)    = true 
StringUtils.isAnyEmpty((String[]) null)  = false 
StringUtils.isAnyEmpty(null, "foo")      = true 
StringUtils.isAnyEmpty("", "bar")        = true 
StringUtils.isAnyEmpty("bob", "")        = true 
StringUtils.isAnyEmpty("  bob  ", null)  = true 
StringUtils.isAnyEmpty(" ", "bar")       = false 
StringUtils.isAnyEmpty("foo", "bar")     = false 
StringUtils.isAnyEmpty(new String[]{})   = false 
StringUtils.isAnyEmpty(new String[]{""}) = true

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * <p>Checks if none of the CharSequences are empty ("") or null.</p>
 *
 * <pre>
 * StringUtils.isNoneEmpty((String) null)    = false
 * StringUtils.isNoneEmpty((String[]) null)  = true
 * StringUtils.isNoneEmpty(null, "foo")      = false
 * StringUtils.isNoneEmpty("", "bar")        = false
 * StringUtils.isNoneEmpty("bob", "")        = false
 * StringUtils.isNoneEmpty("  bob  ", null)  = false
 * StringUtils.isNoneEmpty(new String[] {})  = true
 * StringUtils.isNoneEmpty(new String[]{""}) = false
 * StringUtils.isNoneEmpty(" ", "bar")       = true
 * StringUtils.isNoneEmpty("foo", "bar")     = true
 * </pre>
 *
 * @param css  the CharSequences to check, may be null or empty
 * @return {@code true} if none of the CharSequences are empty or null
 * @since 3.2
 */
public static boolean isNoneEmpty(final CharSequence... css) {
 return !isAnyEmpty(css);
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testIsAnyEmpty() {
  assertTrue(StringUtils.isAnyEmpty((String) null));
  assertFalse(StringUtils.isAnyEmpty((String[]) null));
  assertTrue(StringUtils.isAnyEmpty(null, "foo"));
  assertTrue(StringUtils.isAnyEmpty("", "bar"));
  assertTrue(StringUtils.isAnyEmpty("bob", ""));
  assertTrue(StringUtils.isAnyEmpty("  bob  ", null));
  assertFalse(StringUtils.isAnyEmpty(" ", "bar"));
  assertFalse(StringUtils.isAnyEmpty("foo", "bar"));
}

代码示例来源:origin: apache/nifi

while ((line = br.readLine()) != null) {
  String[] components = line.split("=", 2);
  if (components.length != 2 || StringUtils.isAnyEmpty(components)) {
    logger.warn("Line " + l + " is not properly formatted -- keyId=Base64EncodedKey...");

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>Checks if none of the CharSequences are empty ("") or null.</p>
 *
 * <pre>
 * StringUtils.isNoneEmpty((String) null)    = false
 * StringUtils.isNoneEmpty((String[]) null)  = true
 * StringUtils.isNoneEmpty(null, "foo")      = false
 * StringUtils.isNoneEmpty("", "bar")        = false
 * StringUtils.isNoneEmpty("bob", "")        = false
 * StringUtils.isNoneEmpty("  bob  ", null)  = false
 * StringUtils.isNoneEmpty(new String[] {})  = true
 * StringUtils.isNoneEmpty(new String[]{""}) = false
 * StringUtils.isNoneEmpty(" ", "bar")       = true
 * StringUtils.isNoneEmpty("foo", "bar")     = true
 * </pre>
 *
 * @param css  the CharSequences to check, may be null or empty
 * @return {@code true} if none of the CharSequences are empty or null
 * @since 3.2
 */
public static boolean isNoneEmpty(final CharSequence... css) {
 return !isAnyEmpty(css);
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>Checks if none of the CharSequences are empty ("") or null.</p>
 *
 * <pre>
 * StringUtils.isNoneEmpty((String) null)    = false
 * StringUtils.isNoneEmpty((String[]) null)  = true
 * StringUtils.isNoneEmpty(null, "foo")      = false
 * StringUtils.isNoneEmpty("", "bar")        = false
 * StringUtils.isNoneEmpty("bob", "")        = false
 * StringUtils.isNoneEmpty("  bob  ", null)  = false
 * StringUtils.isNoneEmpty(new String[] {})  = true
 * StringUtils.isNoneEmpty(new String[]{""}) = false
 * StringUtils.isNoneEmpty(" ", "bar")       = true
 * StringUtils.isNoneEmpty("foo", "bar")     = true
 * </pre>
 *
 * @param css  the CharSequences to check, may be null or empty
 * @return {@code true} if none of the CharSequences are empty or null
 * @since 3.2
 */
public static boolean isNoneEmpty(final CharSequence... css) {
 return !isAnyEmpty(css);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>Checks if none of the CharSequences are empty ("") or null.</p>
 *
 * <pre>
 * StringUtils.isNoneEmpty((String) null)    = false
 * StringUtils.isNoneEmpty((String[]) null)  = true
 * StringUtils.isNoneEmpty(null, "foo")      = false
 * StringUtils.isNoneEmpty("", "bar")        = false
 * StringUtils.isNoneEmpty("bob", "")        = false
 * StringUtils.isNoneEmpty("  bob  ", null)  = false
 * StringUtils.isNoneEmpty(new String[] {})  = true
 * StringUtils.isNoneEmpty(new String[]{""}) = false
 * StringUtils.isNoneEmpty(" ", "bar")       = true
 * StringUtils.isNoneEmpty("foo", "bar")     = true
 * </pre>
 *
 * @param css  the CharSequences to check, may be null or empty
 * @return {@code true} if none of the CharSequences are empty or null
 * @since 3.2
 */
public static boolean isNoneEmpty(final CharSequence... css) {
 return !isAnyEmpty(css);
}

代码示例来源:origin: com.github.binarywang/weixin-java-mp

/**
 * 绑定老会员卡信息
 *
 * @param name
 * @param url
 */
public void setBindOldCard(String name, String url) {
 if (StringUtils.isAnyEmpty(name, url)) {
  return;
 }
 if (bindOldCard == null)
  bindOldCard = new JsonObject();
 bindOldCard.addProperty("name", name);
 bindOldCard.addProperty("url", url);
}

代码示例来源:origin: binarywang/WxJava

/**
 * 绑定老会员卡信息
 *
 * @param name
 * @param url
 */
public void setBindOldCard(String name, String url) {
 if (StringUtils.isAnyEmpty(name, url)) {
  return;
 }
 if (bindOldCard == null)
  bindOldCard = new JsonObject();
 bindOldCard.addProperty("name", name);
 bindOldCard.addProperty("url", url);
}

代码示例来源:origin: com.github.binarywang/weixin-java-mp

/**
  * 设置服务声明,用于放置商户会员卡守则
  *
  * @param name
  * @param url
  */
 public void setServiceStatement(String name, String url) {
  if (StringUtils.isAnyEmpty(name, url)) {
   return;
  }
  if (serviceStatement == null)
   serviceStatement = new JsonObject();
  serviceStatement.addProperty("name", name);
  serviceStatement.addProperty("url", url);
 }
}

代码示例来源:origin: binarywang/WxJava

/**
  * 设置服务声明,用于放置商户会员卡守则
  *
  * @param name
  * @param url
  */
 public void setServiceStatement(String name, String url) {
  if (StringUtils.isAnyEmpty(name, url)) {
   return;
  }
  if (serviceStatement == null)
   serviceStatement = new JsonObject();
  serviceStatement.addProperty("name", name);
  serviceStatement.addProperty("url", url);
 }
}

代码示例来源:origin: com.cognifide.aet/jobs

private void validateAddAction(ValidationResultBuilder builder) {
 if (StringUtils.isAnyEmpty(name, value)) {
  String message = String.format("Missing %s or %s on Cookie Modifier",
    CookieModifier.NAME_PARAMETER, CookieModifier.VALUE_PARAMETER);
  builder.addErrorMessage(message);
 }
}

代码示例来源:origin: Cognifide/aet

private void validateAddAction(ValidationResultBuilder builder) {
 if (StringUtils.isAnyEmpty(name, value)) {
  String message = String.format("Missing %s or %s on Cookie Modifier",
    CookieModifier.NAME_PARAMETER, CookieModifier.VALUE_PARAMETER);
  builder.addErrorMessage(message);
 }
}

代码示例来源:origin: com.github.binarywang/weixin-java-common

/**
 * 串接arr参数,生成sha1 digest
 */
public static String gen(String... arr) {
 if (StringUtils.isAnyEmpty(arr)) {
  throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
 }
 Arrays.sort(arr);
 StringBuilder sb = new StringBuilder();
 for (String a : arr) {
  sb.append(a);
 }
 return DigestUtils.sha1Hex(sb.toString());
}

代码示例来源:origin: binarywang/WxJava

/**
 * 串接arr参数,生成sha1 digest
 */
public static String gen(String... arr) {
 if (StringUtils.isAnyEmpty(arr)) {
  throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
 }
 Arrays.sort(arr);
 StringBuilder sb = new StringBuilder();
 for (String a : arr) {
  sb.append(a);
 }
 return DigestUtils.sha1Hex(sb.toString());
}

代码示例来源:origin: vakinge/jeesuite-libs

public static String buildQuery(Map<String, String> params, String charset) throws IOException {
  if (params == null || params.isEmpty()) {
    return null;
  }
  StringBuilder query = new StringBuilder();
  Set<Entry<String, String>> entries = params.entrySet();
  boolean hasParam = false;
  for (Entry<String, String> entry : entries) {
    String name = entry.getKey();
    String value = entry.getValue();
    // 忽略参数名或参数值为空的参数
    if (StringUtils.isAnyEmpty(name, value)) {
      if (hasParam) {
        query.append("&");
      } else {
        hasParam = true;
      }
      query.append(name).append("=").append(URLEncoder.encode(value, charset));
    }
  }
  return query.toString();
}

代码示例来源:origin: com.github.binarywang/weixin-java-common

/**
  * 用&串接arr参数,生成sha1 digest
  */
 public static String genWithAmple(String... arr) {
  if (StringUtils.isAnyEmpty(arr)) {
   throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
  }

  Arrays.sort(arr);
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < arr.length; i++) {
   String a = arr[i];
   sb.append(a);
   if (i != arr.length - 1) {
    sb.append('&');
   }
  }
  return DigestUtils.sha1Hex(sb.toString());
 }
}

代码示例来源:origin: binarywang/WxJava

/**
  * 用&串接arr参数,生成sha1 digest
  */
 public static String genWithAmple(String... arr) {
  if (StringUtils.isAnyEmpty(arr)) {
   throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
  }

  Arrays.sort(arr);
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < arr.length; i++) {
   String a = arr[i];
   sb.append(a);
   if (i != arr.length - 1) {
    sb.append('&');
   }
  }
  return DigestUtils.sha1Hex(sb.toString());
 }
}

代码示例来源:origin: com.microsoft.azure.kusto/kusto-data

public Results execute(String database, String command, ClientRequestProperties properties) throws DataServiceException, DataClientException {
  if (StringUtils.isAnyEmpty(database, command)) {
    throw new IllegalArgumentException("database or command are empty");

代码示例来源:origin: iSafeBlue/TrackRay

if(StringUtils.isAnyEmpty(scanId,scanSessionId)){

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components

log.debug("Boundary Extractor {}: processing result", getName());
if (StringUtils.isAnyEmpty(getLeftBoundary(), getRightBoundary(), getRefName())) {
  throw new IllegalArgumentException(
      "One of the mandatory properties is missing in Boundary Extractor:" + getName());

相关文章

StringUtils类方法