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:costumetrade.common.verify.CapchaController.java

@EscapeLogin
@RequestMapping("/capcha/get")
public void get(String businessKey, HttpServletResponse response) throws IOException {

    if (StringUtils.isBlank(businessKey)) {
        throw new IllegalArgumentException("key?");
    }/*ww  w  .  ja v a  2  s.  c  o m*/

    response.setContentType("image/png");
    response.setDateHeader("exprise", -1);
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    Pair<String, BufferedImage> codeImage = ImageVerification.create();
    captchaService.save(businessKey, codeImage.first());
    OutputStream outputStream = response.getOutputStream();
    ImageIO.write(codeImage.second(), "png", outputStream);
    outputStream.flush();
}

From source file:com.github.jackygurui.vertxredissonrepository.repository.index.LongScoreResolver.java

@Override
public Double resolve(Object value, JsonObject root, String id, String fieldName, RedissonIndex index) {
    if (StringUtils.isBlank(index.scoreField())) {
        return ((Long) value).doubleValue();
    } else {/*w ww. j  av a  2 s. c  o m*/
        return root.getDouble(index.scoreField());
    }
}

From source file:io.wcm.handler.url.rewriter.impl.UrlExternalizerTransformerConfig.java

private static Map<String, String> toElementAttributeNamesMap(String[] elementAttributeNames) {
    Map<String, String> map = new HashMap<>();
    for (String item : elementAttributeNames) {
        String elementName = StringUtils.trim(StringUtils.substringBefore(item, ELEMENT_ATTRIBUTE_SEPARATOR));
        String attributeName = StringUtils.trim(StringUtils.substringAfter(item, ELEMENT_ATTRIBUTE_SEPARATOR));
        if (StringUtils.isBlank(elementName) || StringUtils.isBlank(attributeName)) {
            log.info("Invalid URL externalizier transformer configuration - skipping invalid element entry: "
                    + item);/*from  www. j a v a 2s .com*/
        } else if (map.containsKey(elementName)) {
            log.info("Invalid URL externalizier transformer configuration - skipping duplicate element name: "
                    + item);
        } else {
            map.put(elementName, attributeName);
        }
    }
    return map;
}

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

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }/*www . jav a2s.c o  m*/
    return this.concursoFacade.findConcursoWithCargo(new Long(value));
}

From source file:com.quatico.base.aem.test.model.PathIterator.java

public PathIterator(String path) {
    if (StringUtils.isBlank(path)) {
        this.path = null;
        this.length = 0;
        this.current = 0;
        this.startPos = 0;
        this.isAbsolute = false;
    } else {/*from  w  w w .ja v a  2s. com*/
        this.isAbsolute = path.startsWith(SEPARATOR);
        this.path = path.split(SEPARATOR);
        this.length = this.path.length;
        this.current = this.path.length - 1;
        this.startPos = 0;
    }
}

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

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//  w  w w .  ja v  a2 s. co  m
    return this.inscricaoFacade.findById(new Long(value));
}

From source file:br.ufac.sion.inscricao.converter.ConcursoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//w  w  w.j  av  a  2s  .  co  m
    return this.concursoFacade.findById(new Long(value));
}

From source file:com.nesscomputing.quartz.QuartzJobStatistics.java

QuartzJobStatistics(final MetricsRegistry metricsRegistry, final JobKey jobKey) {
    final String keyName = jobKey.getName()
            + (StringUtils.isBlank(jobKey.getGroup()) || JobKey.DEFAULT_GROUP.equals(jobKey.getGroup()) ? ""
                    : "-" + jobKey.getGroup());

    this.runtime = metricsRegistry.newTimer(new MetricName("ness.quartz.job", "statistics", keyName),
            TimeUnit.MILLISECONDS, TimeUnit.MINUTES);
}

From source file:ch.cyberduck.core.local.LaunchServicesFileDescriptor.java

@Override
public String getKind(final String filename) {
    if (StringUtils.isBlank(FilenameUtils.getExtension(filename))) {
        final String kind = this.kind(filename);
        if (StringUtils.isBlank(kind)) {
            return LocaleFactory.localizedString("Unknown");
        }/*from ww w. j av a  2s  .  c  o  m*/
        return kind;
    }
    final String kind = this.kind(FilenameUtils.getExtension(filename));
    if (StringUtils.isBlank(kind)) {
        return LocaleFactory.localizedString("Unknown");
    }
    return kind;
}

From source file:br.ufac.sion.inscricao.converter.CandidatoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//  w w w. ja  va  2 s.com
    return this.candidatoFacade.findById(new Long(value));
}