List of usage examples for org.apache.commons.lang3 StringUtils isEmpty
public static boolean isEmpty(final CharSequence cs)
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false
NOTE: This method changed in Lang version 2.0.
From source file:com.ankang.report.util.BeanUtil.java
public synchronized static Object getBean(String beanName) { try {//from w ww . j a va 2 s . co m if (StringUtils.isEmpty(beanName)) { return null; } return context.getBean(beanName); } catch (BeansException e) { return null; } }
From source file:info.novatec.testit.livingdoc.server.domain.ClasspathSet.java
public static ClasspathSet parse(String classpaths) { ClasspathSet newClasspaths = new ClasspathSet(); if (!StringUtils.isEmpty(classpaths)) { String[] entries = classpaths.split("[\r\n|\n|\r]"); for (String entry : entries) { if (!StringUtils.isEmpty(entry)) { newClasspaths.add(entry.trim()); }// w w w . j av a 2s .co m } } return newClasspaths; }
From source file:com.github.dozermapper.core.classmap.RelationshipType.java
public static RelationshipType valueOf(String relationshipType) { if (CUMULATIVE_VALUE.equals(relationshipType)) { return CUMULATIVE; } else if (NON_CUMULATIVE_VALUE.equals(relationshipType)) { return NON_CUMULATIVE; } else if (StringUtils.isEmpty(relationshipType)) { return null; }//w w w . j a va2s. co m throw new IllegalStateException( "relationship-type should be cumulative or non-cumulative. " + relationshipType); }
From source file:com.nridge.core.base.std.WebUtl.java
public static String encodeValue(String aValue) { if (StringUtils.isEmpty(aValue)) return StringUtils.EMPTY; int offset = aValue.indexOf('%'); if (offset != -1) aValue = aValue.replace("%", "%25"); offset = aValue.indexOf('|'); if (offset != -1) aValue = aValue.replace("|", "%7C"); offset = aValue.indexOf('~'); if (offset != -1) aValue = aValue.replace("~", "%7E"); offset = aValue.indexOf(';'); if (offset != -1) aValue = aValue.replace(";", "%3B"); offset = aValue.indexOf('/'); if (offset != -1) aValue = aValue.replace("/", "%2F"); offset = aValue.indexOf('?'); if (offset != -1) aValue = aValue.replace("?", "%3F"); offset = aValue.indexOf(':'); if (offset != -1) aValue = aValue.replace(":", "%3A"); offset = aValue.indexOf('&'); if (offset != -1) aValue = aValue.replace("&", "%26"); offset = aValue.indexOf('='); if (offset != -1) aValue = aValue.replace("=", "%3D"); offset = aValue.indexOf('+'); if (offset != -1) aValue = aValue.replace("+", "%2B"); offset = aValue.indexOf('$'); if (offset != -1) aValue = aValue.replace("$", "%24"); offset = aValue.indexOf(','); if (offset != -1) aValue = aValue.replace(",", "%2C"); offset = aValue.indexOf('#'); if (offset != -1) aValue = aValue.replace("#", "%23"); offset = aValue.indexOf('^'); if (offset != -1) aValue = aValue.replace("^", "%5E"); offset = aValue.indexOf('['); if (offset != -1) aValue = aValue.replace("[", "%5B"); offset = aValue.indexOf(']'); if (offset != -1) aValue = aValue.replace("]", "%5D"); offset = aValue.indexOf('\"'); if (offset != -1) aValue = aValue.replace("\"", "%22"); offset = aValue.indexOf('\\'); if (offset != -1) aValue = aValue.replace("\\", "%5C"); offset = aValue.indexOf(' '); if (offset != -1) aValue = aValue.replace(" ", "+"); return aValue; }
From source file:cz.muni.fi.editor.services.commons.Assert.java
public static void fieldIsEmpty(String fieldValue, String fieldName) throws FieldException { if (StringUtils.isEmpty(fieldValue)) { throw new FieldException(fieldName, MessageFormat.format("Field {0} is empty.", fieldName)); }/*from w w w . j a v a2 s .co m*/ }
From source file:io.cloudslang.lang.runtime.configuration.SlangRuntimeSpringConfig.java
private static void setPythonIoEncoding() { String encodingValue = System.getProperty(SlangSystemPropertyConstant.CSLANG_ENCODING.getValue()); if (StringUtils.isEmpty(encodingValue)) { encodingValue = StandardCharsets.UTF_8.name(); }/* w w w . j av a2s .co m*/ System.getProperties().setProperty(PySystemState.PYTHON_IO_ENCODING, encodingValue); }
From source file:cn.vlabs.clb.server.ui.frameservice.URLBuilder.java
public static String getDocURL(String storageKey, String ext) { if (StringUtils.isEmpty(storageKey)) return null; return NGX_DOMAIN + "/" + DOC_CTX + "/" + storageKey + "." + ext; }
From source file:com.uimirror.core.framework.rest.util.WebUtil.java
/** * <p>Converts a String into URL.</p> * * <pre>/*from w w w.ja v a 2 s. co m*/ * WebUtil.getUrl(null) = <code>IllegalArgumentException("URL can't be formed, Correct the input")</code> * </pre> * * @param spec the String to convert to java.net.URL * @return <code> {@link URL}</code> if the String is a valid url * @since 1.0 */ public static URL getUrl(String spec) { if (StringUtils.isEmpty(spec)) { throw new IllegalArgumentException("URL can't be formed, Correct the input"); } try { return new URL(spec); } catch (MalformedURLException e) { throw new IllegalArgumentException("URL can't be formed, url string is mailformed"); } }
From source file:com.streamsets.pipeline.stage.lib.aws.AWSUtil.java
public static AWSCredentialsProvider getCredentialsProvider(AWSConfig config) throws StageException { AWSCredentialsProvider credentialsProvider; if (!StringUtils.isEmpty(config.awsAccessKeyId.get()) && !StringUtils.isEmpty(config.awsSecretAccessKey.get())) { credentialsProvider = new AWSStaticCredentialsProvider( new BasicAWSCredentials(config.awsAccessKeyId.get(), config.awsSecretAccessKey.get())); } else {/*from ww w . ja v a 2 s.c o m*/ credentialsProvider = new DefaultAWSCredentialsProviderChain(); } return credentialsProvider; }
From source file:edu.uoa.cs.master.cloudmanufacturingnlp.util.Tools.java
public static boolean doesMatch(String resource, String originalString) { // validation if (StringUtils.isEmpty(resource) || StringUtils.isEmpty(originalString)) { return false; }/*from w w w . j av a 2 s. c o m*/ // directly match if (resource.contains(originalString) || originalString.contains(resource)) { return true; } return false; }