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

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

Introduction

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

Prototype

public static boolean isBlank(final CharSequence cs) 

Source Link

Document

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 

Usage

From source file:com.labs64.mojo.swid.configuration.RegId.java

public String getUnique_id() {
    if (StringUtils.isBlank(unique_id) && StringUtils.isNotBlank(name)) {
        return name;
    }//  w  w  w . j  av  a  2s.  com
    return unique_id;
}

From source file:com.github.yongchristophertang.engine.AssertUtils.java

/**
 * Assert a string is not null or blank.
 *///from   w w w.j a v a 2 s. co  m
public static void stringNotBlank(String s, String message) {
    if (StringUtils.isBlank(s)) {
        throw new IllegalArgumentException(message);
    }
}

From source file:br.ufac.sion.converter.CidadeConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//from   w  ww  .  jav a2s . c  om
    return this.cidadeFacade.findById(new Long(value));
}

From source file:br.ufac.sion.converter.EstadoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//w w w.  j a v a2s .  c o m
    return this.estadoFacade.findById(new Long(value));
}

From source file:com.github.britter.beanvalidators.strings.BlankConstraintValidator.java

@Override
public boolean isValid(final String value, final ConstraintValidatorContext context) {
    return StringUtils.isBlank(value);
}

From source file:io.wcm.wcm.parsys.controller.CssBuilder.java

/**
 * Add CSS class item. Empty/Null items are ignore.d
 * @param cssClass Item/* w  ww.  jav a 2 s. c om*/
 */
public void add(String cssClass) {
    if (StringUtils.isBlank(cssClass)) {
        return;
    }
    String[] parts = StringUtils.split(cssClass, " ");
    for (String part : parts) {
        items.add(StringUtils.trim(part));
    }
}

From source file:com.netsteadfast.greenstep.util.IconUtils.java

public static String getUrl(String basePath, String iconId) throws ServiceException, Exception {
    String url = "";
    if (StringUtils.isBlank(iconId)) {
        return url;
    }/*from  w  w w . jav  a 2 s .  c  o  m*/
    TbSysIcon sysIcon = new TbSysIcon();
    sysIcon.setIconId(iconId);
    sysIcon = sysIconService.findByEntityUK(sysIcon);
    if (sysIcon != null && StringUtils.defaultString(sysIcon.getFileName()).trim().length() > 0) {
        url = basePath + "/" + ICON_FOLDER + StringUtils.defaultString(sysIcon.getFileName());
    }
    return url;
}

From source file:gov.nih.nci.caintegrator.common.DateUtil.java

/**
 * @param dateString string represent of Date
 * @return Date object/*from   w  w w.j  a  v  a2 s  . c  o  m*/
 * @throws ParseException parsing exception
 */
public static Date createDate(String dateString) throws ParseException {
    if (StringUtils.isBlank(dateString)) {
        return null;
    }
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy", Locale.getDefault());
    return formatter.parse(formatDate(dateString));
}

From source file:br.ufac.sion.converter.EmpresaConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }/*from  ww w . j a  v  a  2  s . c om*/
    return this.empresaFacade.findById(new Long(value));
}

From source file:com.netflix.genie.agent.AgentMetadataImpl.java

private static String getAgentHostNameOrFallback() {
    try {//w  ww .  ja v a  2s  .c om
        final String hostName = InetAddress.getLocalHost().getHostName();
        if (!StringUtils.isBlank(hostName)) {
            return hostName;
        }
    } catch (final UnknownHostException e) {
        log.warn("Failed to retrieve local host name", e);
    }
    return FALLBACK_STRING;
}