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:eu.annocultor.triple.ValueHelper.java

public static String lang(Value value, String prefix, String defaultValue) {
    String lang = null;/*from   w w w . j a v a 2s  .  c  o m*/
    if (isLiteral(value)) {
        lang = ((LiteralValue) value).getLang();
    }
    return StringUtils.isBlank(lang) ? defaultValue : (prefix + lang);
}

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

public static boolean isEmpty(SequenceGenerator seq) {
    return StringUtils.isBlank(seq.getName()) && StringUtils.isBlank(seq.getCatalog())
            && StringUtils.isBlank(seq.getSchema()) && StringUtils.isBlank(seq.getSequenceName())
            && (seq.getAllocationSize() == null || seq.getAllocationSize() == 50)
            && (seq.getInitialValue() == null || seq.getInitialValue() == 1);
}

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

public static boolean isEmpty(ClassMembers classMembers) {
    boolean empty = false;
    if (classMembers.getAttributes().isEmpty() && StringUtils.isBlank(classMembers.getPreCode())
            && StringUtils.isBlank(classMembers.getPostCode())) {
        empty = true;/* w w w  . ja v a 2  s . com*/
    }
    return empty;
}

From source file:com.googlecode.jtiger.modules.ecside.core.bean.ExportDefaults.java

static String getEncoding(TableModel model, String encoding) {
    if (StringUtils.isBlank(encoding)) {
        return model.getPreferences().getPreference(PreferencesConstants.EXPORT_ENCODING);
    }//from  w w  w .  jav a 2s.c o m

    return encoding;
}

From source file:com.greenline.guahao.biz.manager.customer.validator.CustomerValidator.java

public static boolean validateCustomerDO(LocalResponseDO<Object> lrd, CustomerDO customer) {
    boolean suc = false;
    String err = null;/* w w w .  ja  v  a 2s.  c om*/
    if (null == customer) {
        err = "?";
    } else {
        if (StringUtils.isBlank(customer.getExtUserId())) {
            err = "?";
        } else if (StringUtils.isBlank(customer.getName())) {
            err = "??";
        } else if (StringUtils.isBlank(customer.getIdcard())) {
            err = "?";
        } else if (!RegexUtil.isIdCard(customer.getIdcard().toLowerCase())) {
            err = "???";
        } else if (StringUtils.isBlank(customer.getMobile())) {
            err = "?";
        } else if (!RegexUtil.isMobile(customer.getMobile())) {
            err = "???";
        } else if (null != customer.getSex()) {
            if (customer.getSex().intValue() != 1 && customer.getSex().intValue() != 2) {
                lrd.addWarn("?");
                customer.setSex(null);
            }
        }
    }
    if (null != err) {
        lrd.setResult(LocalResponseCode.LOCAL_ERROR, err, String.format("?%s", err));
    } else {
        suc = true;
    }
    return suc;
}

From source file:com.taobao.tddl.sample.util.DateUtil.java

/**
 * /*www . j  a  va  2 s.  c  o m*/
 *
 * @param date
 * @param pattern
 * @return
 */
public static String formatDate(Date date, String pattern) {
    if (date == null) {
        return null;
    }
    if (StringUtils.isBlank(pattern)) {
        return null;
    }
    SimpleDateFormat fmt = new SimpleDateFormat(pattern);
    String convStr = fmt.format(date);
    return convStr;
}

From source file:fr.dutra.confluence2wordpress.util.MapUtils.java

public static Map<String, String> split(String str, String entrySep, String keyValueSep) {
    if (StringUtils.isBlank(str)) {
        return null;
    }/*from   w w w.ja va  2s . c o  m*/
    Splitter keyValueSplitter = Splitter.on(keyValueSep).trimResults();
    Splitter entrySplitter = Splitter.on(entrySep).trimResults().omitEmptyStrings();
    return Maps.transformValues(entrySplitter.withKeyValueSeparator(keyValueSplitter).split(str), TRIM_TO_NULL);
}

From source file:com.aqnote.shared.cryptology.cert.util.X509CertFileUtil.java

public static void writeCert(String b64cert, String certFileName) throws IOException {

    if (StringUtils.isBlank(b64cert) || StringUtils.isBlank(certFileName)) {
        return;//  w w w .ja v  a 2s. c  o m
    }
    FileOutputStream fos1 = new FileOutputStream(certFileName);
    fos1.write(b64cert.getBytes());
    fos1.flush();
    fos1.close();
}

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

public static boolean isEmpty(JoinColumn column) {
    boolean empty = false;
    if (StringUtils.isBlank(column.getName()) && StringUtils.isBlank(column.getReferencedColumnName())
            && StringUtils.isBlank(column.getColumnDefinition()) && StringUtils.isBlank(column.getTable())
            && Boolean.TRUE.equals(column.getNullable()) && Boolean.TRUE.equals(column.getInsertable())
            && Boolean.TRUE.equals(column.getUpdatable()) && Boolean.FALSE.equals(column.getUnique())
            && ForeignKeyValidator.isEmpty(column.getForeignKey())) {
        empty = true;// w  ww .  j  a  va2s.c om
    }
    if (!empty && StringUtils.isBlank(column.getName()) && StringUtils.isNotBlank(column.getImplicitName())) {
        column.setName(column.getImplicitName());
        column.setImplicitName(null);
    }
    if (!empty && StringUtils.isBlank(column.getName())) {
        empty = true;
    }
    return empty;
}

From source file:com.aqnote.shared.cryptology.util.lang.CommonUtil.java

public static String ArrayToString(String[] arrays, char sep) {
    String macStr = "";
    for (String b : arrays) {
        if (StringUtils.isBlank(macStr)) {
            macStr = macStr + b;/*w ww .  ja  v  a 2 s. c  om*/
        } else {
            macStr = macStr + sep + b;
        }
    }
    return macStr;
}