List of usage examples for org.apache.commons.lang StringUtils isNotBlank
public static boolean isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
From source file:com.bsb.intellij.plugins.xmlbeans.utils.ValidationUtils.java
public static boolean isValidJvmMemoryParameter(String jvmMemoryParameter) { return StringUtils.isNotBlank(jvmMemoryParameter) && jvmMemoryParameter.matches(JVM_MEMORY_PARAM_REGEX); }
From source file:com.edm.utils.View.java
/** * ?./*from w w w . j av a 2 s .c o m*/ */ public String value(String value, String defaultValue) { if (StringUtils.isNotBlank(value)) return value; return defaultValue; }
From source file:net.pms.configuration.ConfigurationUtil.java
/** * Return the <code>String</code> value for a given configuration key if the * value is non-blank (i.e. not null, not an empty string, not all whitespace). * Otherwise return the supplied default value. * The value is returned with leading and trailing whitespace removed in both cases. * @param configuration The configuration to look up the key in. * @param key The key to look up.// w w w . j av a2 s . co m * @param def The default value to return when no valid key value can be found. * @return The value configured for the key. */ // package-private static String getNonBlankConfigurationString(Configuration configuration, String key, String def) { String value = configuration.getString(key); if (StringUtils.isNotBlank(value)) { return value.trim(); } else if (def != null) { return def.trim(); } else { return def; } }
From source file:com.haulmont.cuba.web.toolkit.FileUploadTypesHelper.java
public static String convertSeparator(String types, String originSeparator, String separator) { return StringUtils.isNotBlank(types) ? types.replace(originSeparator, separator) : null; }
From source file:com.activecq.api.utils.ValidationUtil.java
/** * Checks if the value @ key exists and is not null and not white space * * @param form//from ww w .j a v a 2s . c om * @param key * @return */ public static boolean isPresent(ActiveForm form, String key) { if (!form.has(key)) { return false; } Object val = form.get(key, Object.class); if (val instanceof String) { return StringUtils.isNotBlank((String) val); } else { return val != null; } }
From source file:io.github.jeddict.jpa.spec.validator.column.JoinColumnValidator.java
public static boolean isEmpty(JoinColumn column) { boolean empty = false; if (StringUtils.isBlank(column.getName()) && StringUtils.isBlank(column.getReferencedColumnName()) && StringUtils.isBlank(column.getColumnDefinition()) && StringUtils.isBlank(column.getTable()) && Boolean.TRUE.equals(column.getNullable()) && Boolean.TRUE.equals(column.getInsertable()) && Boolean.TRUE.equals(column.getUpdatable()) && Boolean.FALSE.equals(column.getUnique()) && ForeignKeyValidator.isEmpty(column.getForeignKey())) { empty = true;/*w w w. j a v a 2 s.c o m*/ } if (!empty && StringUtils.isBlank(column.getName()) && StringUtils.isNotBlank(column.getImplicitName())) { column.setName(column.getImplicitName()); column.setImplicitName(null); } if (!empty && StringUtils.isBlank(column.getName())) { empty = true; } return empty; }
From source file:com.googlecode.markuputils.CssStyleUtils.java
public static String openSelector(String selector) { StringBuilder buffer = new StringBuilder(); if (StringUtils.isNotBlank(selector)) { buffer.append(selector).append(" {"); }/* w w w . j a v a 2 s . c o m*/ return buffer.toString(); }
From source file:ips1ap101.lib.core.jsf.component.Pestanya.java
/** * {@inheritDoc}/*from w w w . jav a 2 s. co m*/ */ @Override public String getText() { Object superobj = super.getText(); String superstr = superobj == null ? null : superobj.toString(); if (StringUtils.isNotBlank(superstr) && getValueExpression("text") == null) { if (superstr != null && superstr.startsWith("BundleDominios.")) { int i = superstr.indexOf('.'); String key = superstr.substring(i + 1).trim(); if (key.length() > 0) { return BundleDominios.getShortLabel(key); } } } return superstr; }
From source file:com.jsmartframework.web.manager.TagEncrypter.java
static void init() { try {/* ww w .ja va 2 s . c o m*/ String customKey = CONFIG.getContent().getTagSecretKey(); if (StringUtils.isNotBlank(customKey)) { if (customKey.length() != CYPHER_KEY_LENGTH) { throw new RuntimeException("Custom tag-secret-key must have its value " + "with [" + CYPHER_KEY_LENGTH + "] characters"); } secretKey = new SecretKeySpec(customKey.getBytes("UTF8"), "AES"); } else { secretKey = new SecretKeySpec(DEFAULT_KEY.getBytes("UTF8"), "AES"); } } catch (UnsupportedEncodingException ex) { LOGGER.log(Level.INFO, "Failed to generate key secret for tag: " + ex.getMessage()); } }
From source file:com.vmware.bdd.usermgmt.TestSssdConfigurationGenerator.java
public static void setupSssdTemplates() throws IOException { String tmpDirPath = System.getProperty("java.io.tmpdir"); if (StringUtils.isNotBlank(System.getProperty("serengeti.home.dir"))) { System.setProperty("serengeti.home.dir.bak", System.getProperty("serengeti.home.dir")); }/*from w w w .j a v a2 s . com*/ System.setProperty("serengeti.home.dir", tmpDirPath); File usermgmrConfDir = new File( System.getProperty("serengeti.home.dir") + File.separator + "conf" + File.separator + "usermgmt"); usermgmrConfDir.mkdirs(); usermgmrConfDir.deleteOnExit(); File tmpFile = new File(usermgmrConfDir, SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "LDAP"); tmpFile.createNewFile(); tmpFile.deleteOnExit(); FileCopyUtils.copy(readResource(SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "LDAP"), new FileWriter(tmpFile)); tmpFile = new File(usermgmrConfDir, SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "AD_AS_LDAP"); tmpFile.createNewFile(); tmpFile.deleteOnExit(); FileCopyUtils.copy(readResource(SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "AD_AS_LDAP"), new FileWriter(tmpFile)); }