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

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

Introduction

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

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:ch.algotrader.config.spring.ConfigLoader.java

static void loadResource(final Map<String, String> paramMap, final Resource resource) throws IOException {

    try (InputStream inputStream = resource.getInputStream()) {
        Properties props = new Properties();
        props.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8));

        for (Map.Entry<Object, Object> entry : props.entrySet()) {
            String paramName = (String) entry.getKey();
            String paramValue = (String) entry.getValue();
            if (StringUtils.isNotBlank(paramName)) {
                paramMap.put(paramName, paramValue);
            }/*from   w w  w  .ja  v a2 s  .  c  om*/
        }

    }
}

From source file:io.sidecar.credential.Credential.java

public Credential(String username, String password) {

    Preconditions.checkNotNull(username);
    Preconditions.checkArgument(StringUtils.isNotBlank(username));
    Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(username));
    this.username = username;

    Preconditions.checkNotNull(password);
    Preconditions.checkArgument(StringUtils.isNotBlank(password));
    Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(password));
    this.password = password;
}

From source file:com.gst.infrastructure.core.api.ApiParameterHelper.java

public static Set<String> extractFieldsForResponseIfProvided(final MultivaluedMap<String, String> queryParams) {
    Set<String> fields = new HashSet<>();
    String commaSerperatedParameters = "";
    if (queryParams.getFirst("fields") != null) {
        commaSerperatedParameters = queryParams.getFirst("fields");
        if (StringUtils.isNotBlank(commaSerperatedParameters)) {
            fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
        }/*from  ww w  . java2 s. c o m*/
    }
    return fields;
}

From source file:com.ssic.education.handle.dao.ProLicenseDao.java

public ProLicense findById(String id) {
    ProLicenseExample example = new ProLicenseExample();
    ProLicenseExample.Criteria criteria = example.createCriteria();
    if (StringUtils.isNotBlank(id)) {
        criteria.andIdEqualTo(id);/*w  w w  .jav a  2  s . c  o  m*/
    }
    List<ProLicense> proLicenses = mapper.selectByExample(example);
    if (null != proLicenses && proLicenses.size() > 0) {
        return proLicenses.get(0);
    }
    return null;
}

From source file:io.sidecar.Error.java

public Error(String status, String message) {
    Preconditions.checkArgument(StringUtils.isNotBlank(message));
    this.status = status;

    Preconditions.checkArgument(StringUtils.isNotBlank(message));
    this.message = message;
}

From source file:com.eyeq.pivot4j.util.CssWriter.java

/**
 * @param name/*from   w  w w.ja  va  2 s  .  c  om*/
 * @param value
 */
public void writeStyle(String name, String value) {
    if (StringUtils.isNotBlank(value)) {
        writer.print(name);
        writer.print(": ");
        writer.print(value);
        writer.print(";");
    }
}

From source file:hudson.plugins.simpleupdatesite.Plugin.java

/**
 * Init/*from ww w.j a  v  a  2s . c  o  m*/
 * 
 * @param hpiFile
 *            the hpi file
 * @param baseUrl
 * @throws IOException
 */
public void init(File hpiFile, String baseUrl) throws IOException {
    this.hpi = HPI.loadHPI(hpiFile);
    this.excerpt = getExcerpt(hpiFile);
    this.excerpt = this.excerpt.replace("\r\n", "<br/>\n");
    String wiki = getWiki(hpiFile);
    if (StringUtils.isNotBlank(wiki)) {
        this.hpi.setWiki(wiki);
    }
    this.url = String.format("%s/%s.hpi", baseUrl, this.hpi.getName());
}

From source file:cn.vlabs.duckling.vwb.service.dml.html2dml.ForgetNullValuesLinkedHashMap.java

public String put(String key, String value) {
    if (StringUtils.isNotBlank(value)) {
        return super.put(key, value);
    }//from  w  w  w . j av  a  2s. c  o m
    return null;
}

From source file:gr.abiss.calipso.wicket.components.formfields.HumanTimeDurationConverter.java

/**
 * @param value//from   ww  w.j av  a2  s.c om
 * @return
 */
public static String denormalize(String stringValue, Localizer localizer, Component component) {
    if (StringUtils.isNotBlank(stringValue)) {
        // TODO: optimize using a single regexp to replace?
        stringValue = stringValue.replaceAll(" ms", localizer.getString("milliseconds", component))
                .replaceAll(" s", localizer.getString("seconds", component))
                .replaceAll(" m", localizer.getString("minutes", component))
                .replaceAll(" h", localizer.getString("hours", component))
                .replaceAll(" d", localizer.getString("days", component))
                .replaceAll(" y", localizer.getString("years", component));
    }
    return stringValue;
}

From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.ParsedStatement.java

/**
 * @param matcher//  w w w . ja  va 2  s .c om
 * @return Parsed statement
 */
public static ParsedStatement fromMatcher(Matcher matcher) {
    if (matcher.groupCount() >= 5) {
        String command = matcher.group(1);
        String variable = matcher.group(3);
        String value = matcher.group(5);
        if (StringUtils.isNotBlank(command) && StringUtils.isNotBlank(variable)
                && StringUtils.isNotBlank(value)) {
            return new ParsedStatement(command, variable, value);
        }
    }
    return null;
}