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.ewcms.publication.freemarker.directive.page.skip.NextSkip.java

@Override
public PageOut skip(Integer count, Integer number, String label, UriRuleable uriRule,
        Map<String, Object> uriParams) throws PublishException {

    label = StringUtils.isBlank(label) ? DEFAULT_LABEL : label;
    ++number;//from  www  .  ja  v  a 2 s .c om
    boolean active = (number < count);
    int next = number >= count ? count - 1 : number;
    String url = uriRule.uri(putPageParam(uriParams, next));

    return new PageOut(count, next, label, url, active);
}

From source file:com.ewcms.publication.freemarker.directive.page.skip.PreviousSkip.java

@Override
public PageOut skip(Integer count, Integer number, String label, UriRuleable uriRule,
        Map<String, Object> uriParams) throws PublishException {

    label = StringUtils.isBlank(label) ? DEFAULT_LABEL : label;
    --number;//from  w w w.  j a va 2s.co m
    boolean active = (number >= 0);
    int prev = number <= 0 ? 0 : (number);
    String url = uriRule.uri(putPageParam(uriParams, prev));

    return new PageOut(count, prev, label, url, active);
}

From source file:com.mycompany.listBoxer.services.impl.ListBoxerServiceImpl.java

@Override
public Boolean saveContent(String userInput) {
    if (StringUtils.isBlank(userInput)) {
        return Boolean.FALSE;
    }/*from   www. j  a  va2 s.  c  o m*/

    content.add(userInput);
    return Boolean.TRUE;
}

From source file:ch.cyberduck.core.DefaultPathKindDetector.java

@Override
public Path.Type detect(final String path) {
    if (StringUtils.isBlank(path)) {
        return Path.Type.directory;
    }/*from   w ww.  jav a2  s. co m*/
    if (path.endsWith(String.valueOf(Path.DELIMITER))) {
        return Path.Type.directory;
    }
    if (StringUtils.isBlank(FilenameUtils.getExtension(path))) {
        return Path.Type.directory;
    }
    return Path.Type.file;
}

From source file:com.wavemaker.commons.json.deserializer.WMLocalTimeDeserializer.java

public static LocalTime getLocalDateTime(String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }/*from ww  w .  j ava  2  s .  com*/
    return dateTimeFormatter.parseLocalTime(value);
}

From source file:my.demo.MyDemoServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    if (!StringUtils.isBlank(getServletContext().getInitParameter("HOME_SHARED_DOCS"))) {
        HOME_SHARED_DOCS = getServletContext().getInitParameter("HOME_SHARED_DOCS");
        File f = new File(HOME_SHARED_DOCS);
        if (!f.exists()) {
            f.mkdirs();// www. j av  a  2 s  . c o m
        }
    }
    if (!StringUtils.isBlank(getServletContext().getInitParameter("THUMBNAIL")))
        THUMBNAIL = getServletContext().getInitParameter("THUMBNAIL");
    if (!StringUtils.isBlank(getServletContext().getInitParameter("SHARED_DOCS")))
        SHARED_DOCS = getServletContext().getInitParameter("SHARED_DOCS");
    if (!StringUtils.isBlank(getServletContext().getInitParameter("REALOBJECTURL")))
        REALOBJECTURL = getServletContext().getInitParameter("REALOBJECTURL");
}

From source file:com.apus.hades.api.request.ad.AdInfoRequest.java

/**
 * ??./*from w w w .  jav  a 2s  .co  m*/
 *
 * @return
 */
public List<Pcs> getPcsList() {
    if (StringUtils.isBlank(positions)) {
        return null;
    }
    List<Pcs> list = FastJsonUtils.toList(positions, Pcs.class);
    return list;
}

From source file:com.wavemaker.commons.json.deserializer.WMSqlDateDeSerializer.java

public static Date getDate(String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//from  w w w  .  j  av a2s.c o  m
    try {
        java.util.Date parsedDate = new SimpleDateFormat(DEFAULT_DATE_FORMAT).parse(value);
        return new Date(parsedDate.getTime());
    } catch (ParseException e) {
        throw new WMRuntimeException("Failed to parse the string " + value + "as java.sql.Date", e);
    }
}

From source file:com.wavemaker.commons.json.deserializer.WMLocalDateTimeDeSerializer.java

public static LocalDateTime getLocalDateTime(String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//from   w w w. j av  a 2s . com
    return parser.parseLocalDateTime(value);
}

From source file:com.netflix.genie.server.util.StringUtil.java

/**
 * Mimics bash command-line parsing as close as possible.<br>
 * Caveat - only supports double quotes, not single quotes.
 *
 * @param input command-line arguments as a string
 * @return argument array that is split using (as to close to) bash rules as
 * possible//from   www  . ja v  a  2s  . c om
 * @throws GenieException If there is any error
 */
public static String[] splitCmdLine(final String input) throws GenieException {
    LOG.debug("Command line: " + input);
    if (StringUtils.isBlank(input)) {
        return new String[0];
    }

    final String[] output;
    try {
        // ignore delimiter if it is within quotes
        output = input.trim().split("[" + ARG_DELIMITER + "]+(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
    } catch (final Exception e) {
        final String msg = "Invalid argument: " + input;
        LOG.error(msg, e);
        throw new GenieServerException(msg, e);
    }

    // "cleanse" inputs - get rid of enclosing quotes
    for (int i = 0; i < output.length; i++) {
        // double quotes
        if (output[i].startsWith("\"") && output[i].endsWith("\"")) {
            output[i] = output[i].replaceAll("(^\")|(\"$)", "");
        }
        LOG.debug(i + ": " + output[i]);
    }
    return output;
}