本文整理了Java中org.apache.commons.lang3.StringUtils.isAllEmpty()
方法的一些代码示例,展示了StringUtils.isAllEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.isAllEmpty()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:isAllEmpty
[英]Checks if all of the CharSequences are empty ("") or null.
StringUtils.isAllEmpty(null) = true
StringUtils.isAllEmpty(null, "") = true
StringUtils.isAllEmpty(new String[] {}) = true
StringUtils.isAllEmpty(null, "foo") = false
StringUtils.isAllEmpty("", "bar") = false
StringUtils.isAllEmpty("bob", "") = false
StringUtils.isAllEmpty(" bob ", null) = false
StringUtils.isAllEmpty(" ", "bar") = false
StringUtils.isAllEmpty("foo", "bar") = false
[中]检查所有字符序列是否为空(“”)或null。
StringUtils.isAllEmpty(null) = true
StringUtils.isAllEmpty(null, "") = true
StringUtils.isAllEmpty(new String[] {}) = true
StringUtils.isAllEmpty(null, "foo") = false
StringUtils.isAllEmpty("", "bar") = false
StringUtils.isAllEmpty("bob", "") = false
StringUtils.isAllEmpty(" bob ", null) = false
StringUtils.isAllEmpty(" ", "bar") = false
StringUtils.isAllEmpty("foo", "bar") = false
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testIsAllEmpty() {
assertTrue(StringUtils.isAllEmpty());
assertTrue(StringUtils.isAllEmpty(new String[]{}));
assertTrue(StringUtils.isAllEmpty((String) null));
assertTrue(StringUtils.isAllEmpty((String[]) null));
assertFalse(StringUtils.isAllEmpty(null, "foo"));
assertFalse(StringUtils.isAllEmpty("", "bar"));
assertFalse(StringUtils.isAllEmpty("bob", ""));
assertFalse(StringUtils.isAllEmpty(" bob ", null));
assertFalse(StringUtils.isAllEmpty(" ", "bar"));
assertFalse(StringUtils.isAllEmpty("foo", "bar"));
assertTrue(StringUtils.isAllEmpty("", null));
}
代码示例来源:origin: kamax-matrix/mxisd
public EmailSmtpConnector(EmailSmtpConfig cfg) {
this.cfg = cfg.build();
Properties sCfg = new Properties();
sCfg.setProperty("mail.smtp.host", cfg.getHost());
sCfg.setProperty("mail.smtp.port", Integer.toString(cfg.getPort()));
// This seems very fiddly as we need to call different connect() methods depending
// If there is authentication or not. We set those for the sake of completeness and
// Backward compatibility. See previously opened issues about Email and SMTP.
if (StringUtils.isAllEmpty(cfg.getLogin(), cfg.getPassword())) {
sCfg.setProperty("mail.smtp.auth", "false");
} else {
sCfg.setProperty("mail.smtp.auth", "true");
}
session = Session.getInstance(sCfg);
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-tool-standards-validator
/**
* Each HTML or HTML5 document must begin with a valid doctype declaration.
* Is considered valid a doctype with "html" name and no attribute.
*/
public void validateRpd6s1()
{
boolean validDocumentType = this.html5Document.childNodes().stream()
.filter(node -> node instanceof DocumentType)
.anyMatch(documentType -> "html".equalsIgnoreCase(documentType.attr("name")) && StringUtils
.isAllEmpty(documentType.attr("publicId"), documentType.attr("systemId")));
assertTrue(Type.ERROR, "rpd6s1.doctype", validDocumentType);
}
代码示例来源:origin: kamax-matrix/mxisd
if (StringUtils.isAllEmpty(cfg.getLogin(), cfg.getPassword())) {
log.info("Not using SMTP authentication");
transport.connect();
内容来源于网络,如有侵权,请联系作者删除!