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.amazon.alexa.avs.auth.companionservice.CompanionServiceRegCodeResponse.java

/**
 * Creates a {@link CompanionServiceRegCodeResponse} object.
 *
 * @param sessionId The sessionId from the companion service.
 * @param regCode The registration code to be shown to the user to register on the companion service.
 *//*from   ww  w.  j  av a2  s . c o  m*/
public CompanionServiceRegCodeResponse(String sessionId, String regCode) {
    if (StringUtils.isBlank(sessionId)) {
        throw new IllegalArgumentException("Missing " + AuthConstants.SESSION_ID + " parameter");
    }

    if (StringUtils.isBlank(regCode)) {
        throw new IllegalArgumentException("Missing " + AuthConstants.REG_CODE + " parameter");
    }

    this.sessionId = sessionId;
    this.regCode = regCode;
}

From source file:de.micromata.genome.gwiki.plugin.mp3extractor_1_0.Mp3TextExtractor.java

private void appendIfExists(StringBuilder sb, String label, String data) {
    if (StringUtils.isBlank(data) == true) {
        return;/* w ww. java 2 s .  c om*/
    }
    sb.append(label).append(": ").append(data).append("\n");
}

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

public static Object getServiceByResource(String system, String id) throws ServiceException, Exception {
    if (StringUtils.isBlank(system) || StringUtils.isBlank(id)) {
        throw new Exception(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }/*  w ww  .  j  a v a 2 s.co  m*/
    SysWsServiceVO wsService = new SysWsServiceVO();
    wsService.setSystem(system);
    wsService.setId(id);
    DefaultResult<SysWsServiceVO> result = sysWsServiceService.findByUK(wsService);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    wsService = result.getValue();
    return getService(wsService.getBeanId(), wsService.getWsdlAddress());
}

From source file:info.novatec.testit.livingdoc.ognl.OgnlResolution.java

public OgnlResolution(String expression) {
    if (StringUtils.isBlank(expression)) {
        throw new IllegalArgumentException("No expression to resolve");
    }/*www . ja v  a  2 s  .c o  m*/

    this.expression = expression;
}

From source file:de.blizzy.documentr.validation.PagePathValidator.java

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
    if (StringUtils.isBlank(value)) {
        return true;
    }// w  w  w .j av a2 s. co  m

    return Pattern.matches("^" + DocumentrConstants.PAGE_PATH_PATTERN + "$", value); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:de.blizzy.documentr.validation.RoleNameValidator.java

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
    if (StringUtils.isBlank(value)) {
        return true;
    }//from ww  w.j  a va2s.com

    return Pattern.matches("^" + DocumentrConstants.ROLE_NAME_PATTERN + "$", value); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:edu.unc.irss.arc.de.dvpublisher.DataverseClient.java

public void publishDatafile(String persistentId, File file) {

    if (StringUtils.isBlank(persistentId)) {
        throw new IllegalArgumentException("persistentId should not be blank");
    } else if (persistentId.startsWith("doi:")) {
        persistentId = persistentId.replace("doi:", "");
    }//from w w  w.java2s  .  c  o  m

    if (!file.exists() || file.length() == 0L) {
        throw new IllegalArgumentException("A target file must exit and be non-empty");
    }

    logger.log(Level.INFO, "persistentId={0}", persistentId);
    apiClient.getDatasetOperations().uploadFile(persistentId, file);

}

From source file:cherry.sqlman.tool.shared.ParamParserImpl.java

@Override
public Map<String, ?> parseMap(String pmap) {
    if (StringUtils.isBlank(pmap)) {
        return new LinkedHashMap<>();
    }//from  w w w  . j  a  v  a  2  s  . co  m
    try {
        JavaType type = TypeFactory.defaultInstance().constructMapType(LinkedHashMap.class, String.class,
                Object.class);
        return objectMapper.readValue(pmap, type);
    } catch (IOException ex) {
        return new LinkedHashMap<>();
    }
}

From source file:com.esspl.datagen.util.DataGenImportUtil.java

public void doImport(String argOption) {
    log.debug("DataGenImportUtil--->doImport() Called.");

    //Import stuff goes here

    if (!StringUtils.isBlank(argOption)) {
        if (argOption.equalsIgnoreCase("sql")) {
            doSqlImport();//www . j a v a  2s .  co  m
        } else {
            doExcelImport();
        }
    } else {
        log.error("DataGenImportUtil--->doImport()-----:  argOption is blank!");
    }

}

From source file:com.esspl.datagen.util.DataGenExportUtil.java

public void doExport(String argOption) {
    log.debug("DataGenExportUtil--->doExport() Called.");

    //Export stuff goes here

    if (!StringUtils.isBlank(argOption)) {
        if (argOption.equalsIgnoreCase("sql")) {
            doSqlExport();/*from w ww . ja  v a  2s  .c o m*/
        } else {
            doExcelExport();
        }
    } else {
        log.error("DataGenExportUtil--->doExport()----- :  argOption is blank!");
    }
}