List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:com.pandich.dropwizard.curator.NodeValue.java
public boolean isBlank() { return StringUtils.isBlank(this.value); }
From source file:fm.pattern.valex.Reportable.java
private static String getMessage(String key) { String message = ValexConfiguration.getMessage(key); return StringUtils.isBlank(message) ? key : message; }
From source file:com.amazon.alexa.avs.auth.OAuth2AccessToken.java
/** * Creates an {@link OAuth2AccessToken} object. * * @param accessToken The accessToken returned from LWA. * @param expiresIn Time in seconds that the accessToken expires in. */// w ww .java 2 s .co m public OAuth2AccessToken(String accessToken, int expiresIn) { if (StringUtils.isBlank(accessToken)) { throw new IllegalArgumentException("Missing " + AuthConstants.OAuth2.ACCESS_TOKEN + " parameter"); } if (expiresIn < 0) { throw new IllegalArgumentException( "Invalid " + AuthConstants.OAuth2.EXPIRES_IN + " value. Must be a positive number."); } Date currentDate = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); calendar.add(Calendar.SECOND, expiresIn); this.accessToken = accessToken; this.expiresTime = calendar.getTime().getTime(); }
From source file:com.creditcloud.tag.utils.TagUtils.java
/** * seperator??Tag/* ww w.ja v a 2 s .c om*/ * * @param tagsString * @param seperator * @return */ public static Tag[] parseTags(String tagsString, String seperator) { if (StringUtils.isBlank(tagsString) || StringUtils.isBlank(seperator)) { return TagConstant.EMPTY_ARRAY; } String[] tagStrings; if (tagsString.contains(seperator)) { tagStrings = tagsString.split(seperator); } else { tagStrings = new String[] { tagsString }; } List<Tag> tags = new ArrayList<>(); for (String tagString : tagStrings) { Tag tag = toTag(tagString); if (tag != null) { tags.add(tag); } } return tags.toArray(new Tag[tags.size()]); }
From source file:com.monarchapis.client.rest.HttpHeader.java
/** * Creates a key-value pair used to represent an http header. * //from ww w.j a v a 2 s .co m * @param name * http name * @param value * http value */ public HttpHeader(final String name, final String value) { if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("Name must not be blank."); } this.name = name; this.value = value; }
From source file:com.netsteadfast.greenstep.action.utils.NotBlankFieldCheckUtils.java
@Override public boolean check(String value) throws ControllerException { return !StringUtils.isBlank(value); }
From source file:cn.guoyukun.spring.jpa.entity.search.filter.Condition.java
/** * ?key?Condition// www. j a va2 s.c om * * @param key name_like * @param value * @return */ static Condition newCondition(final String key, final Object value) throws SearchException { Assert.notNull(key, "Condition key must not null"); String[] searchs = StringUtils.split(key, separator); if (searchs.length == 0) { throw new SearchException("Condition key format must be : property or property_op"); } String searchProperty = searchs[0]; SearchOperator operator = null; if (searchs.length == 1) { operator = SearchOperator.custom; } else { try { operator = SearchOperator.valueOf(searchs[1]); } catch (IllegalArgumentException e) { throw new InvlidSearchOperatorException(searchProperty, searchs[1]); } } boolean allowBlankValue = SearchOperator.isAllowBlankValue(operator); boolean isValueBlank = (value == null); isValueBlank = isValueBlank || (value instanceof String && StringUtils.isBlank((String) value)); isValueBlank = isValueBlank || (value instanceof List && ((List) value).size() == 0); //??? if (!allowBlankValue && isValueBlank) { return null; } Condition searchFilter = newCondition(searchProperty, operator, value); return searchFilter; }
From source file:fm.pattern.valex.config.ValexConfiguration.java
public static ValexConfigurationFile getConfiguration() { if (explicitConfiguration != null) { return explicitConfiguration; }//from www . j a va 2 s . c o m String filename = System.getProperty("valex.config"); if (StringUtils.isBlank(filename)) { return YAML_FILE.isAvailable() ? YAML_FILE : PROPERTY_FILE; } if (filename.endsWith(".yml")) { return new YamlConfigurationFile(filename); } if (filename.endsWith(".properties")) { return new PropertyConfigurationFile(filename); } throw new ValexConfigurationException( "Invalid Valex configuration file '" + filename + "' - file must be a .yml or .properties file"); }
From source file:com.github.britter.beanvalidators.strings.NumericConstraintValidator.java
@Override public boolean isValid(final String value, final ConstraintValidatorContext context) { // Don't validate null, empty and blank strings, since these are validated by @NotNull, @NotEmpty and @NotBlank return StringUtils.isBlank(value) || StringUtils.isNumeric(value); }
From source file:de.micromata.genome.gwiki.plugin.wikilink_1_0.GWikiWikiLinkFragment.java
public static boolean isWikiLinkWord(String text) { if (StringUtils.isBlank(text) == true) { return false; }//from w ww .java2 s. c o m if (text.length() < 4) { return false; } boolean lastUpperCase = true; int uccount = 1; for (int i = 1; i < text.length(); ++i) { char c = text.charAt(i); boolean uc = Character.isUpperCase(c); if (uc == true && lastUpperCase == true) { return false; } uccount += (uc ? 1 : 0); lastUpperCase = uc; } if (uccount > 1) { return true; } else { return false; } }