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

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

Introduction

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

Prototype

public static boolean isBlank(String str) 

Source Link

Document

Checks if a String is whitespace, empty ("") or null.

Usage

From source file:io.github.jeddict.jpa.spec.validator.JsonbDateFormatValidator.java

public static boolean isEmpty(JsonbDateFormat jsonbFormat) {
    boolean empty = false;
    if (StringUtils.isBlank(jsonbFormat.getLocale()) && StringUtils.isBlank(jsonbFormat.getValue())) {
        empty = true;/*ww w  .  j a  v  a 2 s . c  o m*/
    }
    return empty;
}

From source file:com.autentia.common.util.PasswordUtils.java

public static boolean isPasswordInHistory(String pwd, String passwordHistory) {
    if (!StringUtils.isBlank(passwordHistory)) {
        final String[] pwds = passwordHistory.split(EMPTY_SPACE);
        for (int i = 0; i < pwds.length; i++) {
            if (checkIfpasswordsAreEquals(pwd, pwds[i])) {
                throw new PasswordInHistoryException();
            }//from w  w w.  j  a  va  2 s  . c o  m
        }
    }
    return false;
}

From source file:com.kixeye.chassis.bootstrap.aws.UserData.java

public static UserData parse(String userData) {
    if (!StringUtils.isBlank(userData)) {
        StringTokenizer stringTokenizer = new StringTokenizer(userData, "\n");
        while (stringTokenizer.hasMoreTokens()) {
            String line = stringTokenizer.nextToken();
            int envStartIdx = line.indexOf(ENVIRONMENT_TEXT);
            if (envStartIdx >= 0) {
                String env = line.substring(envStartIdx + ENVIRONMENT_TEXT.length());
                return new UserData(StringUtils.trimToNull(env));
            }/*  w  ww.  j  a va  2s  .c  om*/
        }
    }
    throw new BootstrapException("Found no environment data in user-data " + userData);
}

From source file:com.ms.commons.file.image.GravityEnum.java

public static GravityEnum getByValue(String gravity) {
    if (StringUtils.isBlank(gravity)) {
        return null;
    }/*from w  w w  .jav a  2 s.c om*/
    for (GravityEnum g : GravityEnum.values()) {
        if (StringUtils.equalsIgnoreCase(g.getValue(), gravity)) {
            return g;
        }
    }
    return null;
}

From source file:io.github.jeddict.jpa.spec.validator.JsonbNumberFormatValidator.java

public static boolean isEmpty(JsonbNumberFormat jsonbFormat) {
    boolean empty = false;
    if (StringUtils.isBlank(jsonbFormat.getLocale()) && StringUtils.isBlank(jsonbFormat.getValue())) {
        empty = true;/*from  www .ja v a 2  s.  c  om*/
    }
    return empty;
}

From source file:com.greenline.guahao.biz.manager.insurance.validator.InsuranceValidator.java

public static boolean validateProposer(LocalResponseDO<Object> lrd, ProposerDO proposer) {
    boolean suc = false;
    String err = null;/*from  w  ww.j  a va  2s.  c o  m*/
    if (null == proposer) {
        err = "??";
    } else if (StringUtils.isBlank(proposer.getName())) {
        err = "???";
    } else if (StringUtils.isBlank(proposer.getIdcard())) {
        err = "???";
    } else if (!RegexUtil.isIdCard(proposer.getIdcard().toLowerCase())) {
        err = "????";
    } else if (StringUtils.isBlank(proposer.getMobile())) {
        err = "???";
    } else if (!RegexUtil.isMobile(proposer.getMobile())) {
        err = "????";
    } else if (StringUtils.isNotBlank(proposer.getEmail()) && !RegexUtil.isEmail(proposer.getEmail())) {
        err = "??";
    }
    if (null != err) {
        lrd.setResult(LocalResponseCode.LOCAL_ERROR, err, err);
    } else {
        suc = true;
    }
    return suc;
}

From source file:com.carlomicieli.jtrains.validation.ISOValidationUtils.java

/**
 * Returns {@code true} if the value is a valid 2-letter language code as defined in ISO 639.
 * @param lang the language code//from  w w w. j  a va 2 s  .c  om
 * @return {@code true} if the value is a valid language; {@code false} otherwise
 */
public static boolean languageIsValid(String lang) {
    if (StringUtils.isBlank(lang)) {
        return true;
    }
    return Arrays.binarySearch(Locale.getISOLanguages(), lang.toLowerCase()) >= 0;
}

From source file:io.github.jeddict.jpa.spec.validator.TableGeneratorValidator.java

public static boolean isEmpty(TableGenerator tableGenerator) {
    return StringUtils.isBlank(tableGenerator.getName()) && StringUtils.isBlank(tableGenerator.getCatalog())
            && StringUtils.isBlank(tableGenerator.getSchema())
            && StringUtils.isBlank(tableGenerator.getPkColumnName())
            && StringUtils.isBlank(tableGenerator.getPkColumnValue())
            && StringUtils.isBlank(tableGenerator.getTable()) && tableGenerator.getUniqueConstraint().isEmpty()
            && tableGenerator.getIndex().isEmpty() && tableGenerator.getAllocationSize() == 50
            && tableGenerator.getInitialValue() == 0;
}

From source file:io.milton.cloud.server.web.templating.EncodeUtils.java

public static boolean isEmpty(Object val) {
    if (val == null) {
        return true;
    } else if (val instanceof List) {
        List list = (List) val;
        return list.isEmpty();
    } else if (val instanceof String) {
        String s = (String) val;
        return StringUtils.isBlank(s);
    } else {/*from   w w w . ja  v a2s.  com*/
        return false;
    }
}

From source file:biblivre3.administration.reports.ReportUtils.java

public static String formatDeweyString(final String dewey, final int digits) {
    if (StringUtils.isBlank(dewey)) {
        return "";
    }// w  w w .  j ava2 s. c  o  m

    if (digits == -1) {
        return dewey;
    }

    int i = digits;

    StringBuilder format = new StringBuilder();
    for (char c : dewey.toCharArray()) {
        if (i == 0) {
            break;
        }

        if (Character.isDigit(c)) {
            i--;
        }

        format.append(c);
    }

    if (digits < 3) {
        while (format.length() < 3) {
            format.append("0");
        }
    }

    return format.toString();
}