Example usage for org.apache.commons.lang StringUtils isBlank

List of usage examples for org.apache.commons.lang StringUtils isBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isBlank.

Prototype

public static boolean isBlank(String str) 

Source Link

Document

Checks if a String is whitespace, empty ("") or null.

Usage

From source file:com.redhat.rhn.frontend.action.systems.VirtualSystemsFilterMatcher.java

/**
 *
 * {@inheritDoc}/*from  w w  w . j a  v a2 s.c  om*/
 */
public boolean include(Object obj, String filterData, String filterColumn) {
    if (StringUtils.isBlank(filterData) || StringUtils.isBlank(filterColumn)) {
        return true; ///show all if I entered a blank value
    }
    VirtualSystemOverview current = (VirtualSystemOverview) obj;
    String value = "";
    if (current.getIsVirtualHost()) {
        value = current.getServerName();
    } else if (current.getVirtualSystemId() == null) {
        value = current.getName();
    } else {
        value = current.getServerName();
    }
    if (!StringUtils.isBlank(value)) {
        return value.toUpperCase().indexOf(filterData.toUpperCase()) >= 0;
    }
    return false;
}

From source file:com.smartitengineering.util.bean.BeanFactoryRegistrar.java

public static void deregisterBeanFactory(final String beanFactoryContextName) {
    if (StringUtils.isBlank(beanFactoryContextName)) {
        throw new IllegalArgumentException();
    }/* www.  j a v a2 s .  c o  m*/
    synchronized (beanFactories) {
        beanFactories.remove(beanFactoryContextName);
    }
}

From source file:com.adobe.adobemarketingcloud.github.maven.scq.di.MojoConfiguration.java

public static String makeUrl(String url) {
    if (StringUtils.isBlank(url)) {
        return url;
    }//from w w w  . j a v  a2 s. c o  m
    String result = StringUtils.removeEnd(url, "/");
    if (!result.startsWith("http://") && !result.startsWith("https://")) {
        result = StringUtils.removeStart(result, "/");
        result = "http://" + result;
    }
    return result;
}

From source file:com.bagdemir.eboda.validator.PoolSizeValidator.java

@Override
public ValidationResult<String> validate(final String input) {

    final ValidationResult<String> validationResult = new ValidationResult();

    validationResult.setInput(input);/*from   w w w.j  av  a  2s .  c o m*/

    if (StringUtils.isBlank(input)) {
        registerError(validationResult, "Pool size must be an integer value, but it was null.");
    } else {
        validatePoolSize(input, validationResult);
    }

    return validationResult;
}

From source file:groovyx.gaelyk.graelyk.cast.TimeZoneEditor.java

public void setAsText(String text) throws IllegalArgumentException {
    if (StringUtils.isBlank(text)) {
        setValue(null);// w  ww . j a  v a 2s.c  o m
    }
    try {
        setValue(TimeZone.getTimeZone(text));
    } catch (IllegalArgumentException e) {
        // ignore and just set to null
        setValue(null);
    }
}

From source file:com.ms.commons.utilities.StaticContentDeploy.java

private static String getStaticVersion() {
    String property = System.getProperty(KEY_DATA_SOURCE_PROPERTIES);
    if (StringUtils.isBlank(property)) {
        logger.warn("can not find system property:" + KEY_DATA_SOURCE_PROPERTIES);
        return StringUtils.EMPTY;
    }//from w  ww .  j a  v  a  2s .c  o  m
    File propertyFile = new File(property);
    if (!propertyFile.exists()) {
        logger.warn("property file not exists:" + property);
        return StringUtils.EMPTY;
    }
    String staticVersion = getPropertyFromFile(propertyFile, STATIC_VERSION);
    return staticVersion;
}

From source file:com.egt.core.aplicacion.OrdenConjuntoResultados.java

public boolean addCriterio(String columna, EnumCriterioOrden orden) {
    if (StringUtils.isBlank(columna)) {
        return false;
    }//from  www. ja  va  2 s .  c  o  m
    CriterioOrden criterio = new CriterioOrden(columna, orden);
    return criterios.add(criterio);
}

From source file:com.kinglcc.spring.jms.utils.JsonUtils.java

/**
 * json??object// w w w  .ja  va2 s.com
 * 
 * @param jsonString json
 * @param clazz ??
 * @param ignoreUnkownProps ???
 * @return the object converted by json
 */
public static <T> T toObject(String jsonString, Class<T> clazz, boolean... ignoreUnkownProps) {
    if (StringUtils.isBlank(jsonString) || null == clazz) {
        return null;
    }

    try {
        boolean ignore = isIgnoreUnknownProps(ignoreUnkownProps);
        return createMapper(ignore).<T>readValue(jsonString, clazz);
    } catch (Exception e) {
        LOGGER.error("Deserialize {} error", jsonString, e);
        return null;
    }
}

From source file:groovyx.gaelyk.graelyk.cast.CurrencyEditor.java

public void setAsText(String text) throws IllegalArgumentException {
    if (StringUtils.isBlank(text)) {
        setValue(null);//from  www.  j av a2  s  . c o m
    }
    try {
        setValue(Currency.getInstance(text));
    } catch (IllegalArgumentException e) {
        // ignore and just set to null
        setValue(null);
    }
}

From source file:com.xidu.framework.common.util.EnDecoderUtils.java

/**
 * encode input string by specific coding.
 * // w ww  .  ja  v a 2 s.c  o  m
 * @Date : 2011-3-23
 * @param input
 *            - string
 * @param coding
 *            - the coding name
 * @return encoded string
 */
public static String encode(String input, String coding) {
    if (StringUtils.isBlank(input)) {
        return "";
    }
    try {
        return URLEncoder.encode(input, coding);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return input;
}