本文整理了Java中org.apache.commons.lang3.StringUtils.isAllBlank()
方法的一些代码示例,展示了StringUtils.isAllBlank()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.isAllBlank()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:isAllBlank
[英]Checks if all of the CharSequences are empty (""), null or whitespace only.
Whitespace is defined by Character#isWhitespace(char).
StringUtils.isAllBlank(null) = true
StringUtils.isAllBlank(null, "foo") = false
StringUtils.isAllBlank(null, null) = true
StringUtils.isAllBlank("", "bar") = false
StringUtils.isAllBlank("bob", "") = false
StringUtils.isAllBlank(" bob ", null) = false
StringUtils.isAllBlank(" ", "bar") = false
StringUtils.isAllBlank("foo", "bar") = false
StringUtils.isAllBlank(new String[] {}) = true
[中]检查所有字符序列是否为空(“”)、空或仅为空白。
空格由字符#isWhitespace(char)定义。
StringUtils.isAllBlank(null) = true
StringUtils.isAllBlank(null, "foo") = false
StringUtils.isAllBlank(null, null) = true
StringUtils.isAllBlank("", "bar") = false
StringUtils.isAllBlank("bob", "") = false
StringUtils.isAllBlank(" bob ", null) = false
StringUtils.isAllBlank(" ", "bar") = false
StringUtils.isAllBlank("foo", "bar") = false
StringUtils.isAllBlank(new String[] {}) = true
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testIsAllBlank() {
assertTrue(StringUtils.isAllBlank((String) null));
assertTrue(StringUtils.isAllBlank((String[]) null));
assertTrue(StringUtils.isAllBlank(null, null));
assertTrue(StringUtils.isAllBlank(null, " "));
assertFalse(StringUtils.isAllBlank(null, "foo"));
assertFalse(StringUtils.isAllBlank("", "bar"));
assertFalse(StringUtils.isAllBlank("bob", ""));
assertFalse(StringUtils.isAllBlank(" bob ", null));
assertFalse(StringUtils.isAllBlank(" ", "bar"));
assertFalse(StringUtils.isAllBlank("foo", "bar"));
}
代码示例来源:origin: jamesagnew/hapi-fhir
public boolean hasValues() {
return !isAllBlank(getCode(), getDisplay());
}
代码示例来源:origin: jamesagnew/hapi-fhir
public boolean hasValues() {
return !isAllBlank(getSource(), getSourceVersion(), getTarget(), getTargetVersion());
}
代码示例来源:origin: jamesagnew/hapi-fhir
public boolean hasValues() {
return !isAllBlank(getCode(), getDisplay(), getEquivalence(), getComment());
}
代码示例来源:origin: org.openehealth.ipf.commons/ipf-commons-ihe-core
public boolean isEmpty() {
return StringUtils.isAllBlank(id, name);
}
}
代码示例来源:origin: com.blackducksoftware.integration/integration-rest
public boolean isBlank() {
return StringUtils.isAllBlank(username, password);
}
代码示例来源:origin: open-eid/digidoc4j
private void setConfigurationParameter(ConfigurationParameter parameter, String... value) {
if (StringUtils.isAllBlank(value)) {
LOGGER.debug("Parameter <{}> has blank value, hence will not be registered", parameter);
return;
}
LOGGER.debug("Setting parameter <{}> to <{}>", parameter, value);
this.registry.put(parameter, Arrays.asList(value));
}
代码示例来源:origin: phenotips/phenotips
/**
* Given a {@link JSONObject} containing data for an external identifier, returns a {@link Pair} connecting a label
* and its corresponding value.
*
* @param identifierJSON the {@link JSONObject} containing identifier information
* @return a {@link Pair} with the label on the left (key) and the value on the right (value), either of which may
* be blank, but not both; if both the label and the value are empty, {@code null} is returned
*/
private Pair<String, String> toIdentifier(@Nonnull final JSONObject identifierJSON)
{
String label = identifierJSON.optString(INTERNAL_LABEL_KEY);
String value = identifierJSON.optString(INTERNAL_VALUE_KEY);
if (StringUtils.isAllBlank(label, value)) {
return null;
}
return Pair.of(label, value);
}
代码示例来源:origin: phenotips/phenotips
/**
* Takes a {@link Pair} containing identifier data, and returns this data as a {@link JSONObject}.
*
* @param identifier a {@link Pair} containing information for an external identifier
* @return external identifier data as {@link JSONObject}
*/
private JSONObject toJSON(@Nonnull final Pair<String, String> identifier)
{
if (StringUtils.isAllBlank(identifier.getKey(), identifier.getValue())) {
return null;
}
final JSONObject identifierJSON = new JSONObject();
identifierJSON.put(INTERNAL_LABEL_KEY, identifier.getKey());
identifierJSON.put(INTERNAL_VALUE_KEY, identifier.getValue());
return identifierJSON;
}
代码示例来源:origin: phenotips/phenotips
/**
* Takes a {@link BaseObject} of {@code LabeledIdentifierClass} and returns a {@link Pair} connecting a label and
* its corresponding value.
*
* @param identifierObject the XWiki {@link BaseObject} of {@code LabeledIdentifierClass}
* @return a {@link Pair} with the label on the left (key) and the value on the right (value), either of which may
* be blank, but not both; if both the label and the value are empty, {@code null} is returned
*/
private Pair<String, String> toIdentifier(@Nonnull final BaseObject identifierObject)
{
String label = identifierObject.getStringValue(INTERNAL_LABEL_KEY);
String value = identifierObject.getStringValue(INTERNAL_VALUE_KEY);
if (StringUtils.isAllBlank(label, value)) {
return null;
}
return Pair.of(label, value);
}
代码示例来源:origin: com.blackducksoftware.integration/integration-rest
@Override
protected void validate(final BuilderStatus builderStatus) {
if (StringUtils.isAnyBlank(username, password) && !StringUtils.isAllBlank(username, password)) {
builderStatus.addErrorMessage("The username and password must both be populated or both be empty.");
}
}
代码示例来源:origin: com.github.tdomzal/junit-docker-rule
private String describe() {
if (StringUtils.isAllBlank(containerShortId, builder.name(), builder.imageName())) {
return super.toString();
}
return (StringUtils.isNotBlank(builder.name()) ? String.format("'%s' ", builder.name()) : "")
+ (StringUtils.isNotBlank(containerShortId) ? containerShortId + " " : "")
+ builder.imageName();
}
代码示例来源:origin: com.blackducksoftware.integration/hub-common
if (!StringUtils.isAllBlank(projectName, projectVersionName) && (StringUtils.isBlank(projectName) || StringUtils.isBlank(projectVersionName))) {
errorMessages.add("Both projectName and projectVersionName must be provided or omitted together");
代码示例来源:origin: WeBankFinTech/FATE
String metaServiceHost = properties.getProperty("meta.service.host", null);
if (StringUtils.isAllBlank(metaServiceIp, metaServiceHost)) {
throw new IllegalArgumentException("meta.service.ip and meta.service.host cannot be all null");
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql
@Override
public void initialize(KeyValueStoreDescriptor descriptor) {
super.initialize(descriptor);
logger = new JDBCLogger(name);
Map<String, String> properties = descriptor.properties;
dataSourceName = properties.get(DATASOURCE_PROP);
if (StringUtils.isAllBlank(dataSourceName)) {
throw new NuxeoException("Missing " + DATASOURCE_PROP + " property in configuration");
}
String tableProp = properties.get(TABLE_PROP);
String namespace = descriptor.namespace;
String tbl;
if (isBlank(tableProp)) {
tbl = defaultIfBlank(namespace, name).trim();
} else if (isBlank(namespace)) {
tbl = tableProp.trim();
} else {
tbl = tableProp.trim() + "_" + namespace.trim();
}
// check connection, get dialect and create table if needed
runWithConnection(connection -> {
dialect = Dialect.createDialect(connection, null);
getTable(connection, tbl);
});
prepareSQL();
startTTLThread();
}
代码示例来源:origin: WeBankFinTech/FATE
public synchronized BasicMeta.Endpoint getMetaServiceEndpoint() {
if (metaServiceEndpoint == null) {
try {
BasicMeta.Endpoint.Builder builder = BasicMeta.Endpoint.newBuilder();
Properties properties = serverConf.getProperties();
String metaServiceIp = properties.getProperty("meta.service.ip", null);
String metaServiceHost = properties.getProperty("meta.service.host", null);
if (StringUtils.isAllBlank(metaServiceIp, metaServiceHost)) {
throw new IllegalArgumentException("meta.service.ip and meta.service.host cannot be all null");
}
if (StringUtils.isNotBlank(metaServiceIp)) {
builder.setIp(metaServiceIp);
}
if (StringUtils.isNotBlank(metaServiceHost)) {
builder.setHostname(metaServiceHost);
}
String metaServicePort = properties.getProperty("meta.service.port", null);
if (StringUtils.isNotBlank(metaServicePort)) {
builder.setPort(Integer.valueOf(metaServicePort));
} else {
throw new IllegalArgumentException("meta.service.port cannot be null");
}
metaServiceEndpoint = builder.build();
} catch (Exception e) {
LOGGER.info("[ROLL][INIT] init meta-service endpoint failed. using default");
metaServiceEndpoint = RuntimeConstants.getLocalEndpoint(8590);
}
}
return metaServiceEndpoint;
}
代码示例来源:origin: com.blackducksoftware.integration/integration-rest
@Override
protected void validate(final BuilderStatus builderStatus) {
final ProxyInfo tempInfo = buildWithoutValidation();
if (!tempInfo.isBlank()) {
if (StringUtils.isBlank(host) || port <= 0) {
builderStatus.addErrorMessage("The proxy host must be specified and the port must be greater than zero.");
}
if (!StringUtils.isAllBlank(ntlmDomain, ntlmWorkstation) && (null == credentials || credentials.isBlank())) {
builderStatus.addErrorMessage("Proxy username and password must be set for the NTLM proxy.");
}
}
}
代码示例来源:origin: WeBankFinTech/FATE
String hostname = callback.getHostname();
if (!StringUtils.isAllBlank(ip, hostname)
&& (routeNeighbours.contains(ip) || routeNeighbours.contains(hostname))) {
result = callback;
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
/**
* Sets the doctype setting
*
* @param inDoctype
* The doctype to be set. If <code>doctype</code> is
* <code>null</code> or a blank string, {@link HTMLAssertion#DEFAULT_DOCTYPE} will be
* used
*/
public void setDoctype(String inDoctype) {
if (StringUtils.isAllBlank(inDoctype)) {
setProperty(new StringProperty(DOCTYPE_KEY, DEFAULT_DOCTYPE));
} else {
setProperty(new StringProperty(DOCTYPE_KEY, inDoctype));
}
}
代码示例来源:origin: apache/syncope
|| (StringUtils.isBlank(originaObj.getUDynMembershipCond()) && StringUtils.isNotBlank(inner.
getUDynMembershipCond()))
|| StringUtils.isAllBlank(originaObj.getUDynMembershipCond(), inner.getUDynMembershipCond())
|| !inner.getUDynMembershipCond().equals(originaObj.getUDynMembershipCond())
|| !CollectionUtils.diff(inner.getTypeExtensions(), originaObj.getTypeExtensions()).isEmpty();
内容来源于网络,如有侵权,请联系作者删除!