Example usage for org.apache.commons.lang3 StringUtils EMPTY

List of usage examples for org.apache.commons.lang3 StringUtils EMPTY

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils EMPTY.

Prototype

String EMPTY

To view the source code for org.apache.commons.lang3 StringUtils EMPTY.

Click Source Link

Document

The empty String "" .

Usage

From source file:com.omnigon.aem.common.utils.LocaleUtils.java

public static String getLanguageCountryCode(Locale locale) {
    if (locale != null) {
        StringBuilder b = new StringBuilder();

        if (StringUtils.isNotBlank(locale.getLanguage())) {
            b.append(locale.getLanguage().toLowerCase());
        }/* w w  w  . j a va2  s  .  co m*/

        if (StringUtils.isNotBlank(locale.getCountry())) {
            b.append("_");
            b.append(locale.getCountry().toLowerCase());
        }

        return b.toString();
    } else {
        return StringUtils.EMPTY;
    }
}

From source file:com.omnigon.aem.handlebars.helpers.UniqueId.java

public static String generateUniqueId(String directoryPath) {
    byte[] bytesDirectoryPath = null;
    MessageDigest md = null;/*w ww. j  a v a2  s . c o m*/
    try {
        bytesDirectoryPath = directoryPath.getBytes(CharEncoding.UTF_8);
        md = MessageDigest.getInstance(MESSAGE_DIGEST_TYPE);
    } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
        logger.error(e.getMessage(), e);
        return StringUtils.EMPTY;
    }
    md.reset();
    md.update(bytesDirectoryPath);
    String uniqueId = DatatypeConverter.printHexBinary(md.digest());
    return StringUtils.substring(uniqueId, 0, UNIQUE_ID_LENGTH);
}

From source file:com.msg.wmTestHelper.util.ProprietaryHelper.java

public static String getConfig(@NonNull String configName) {
    return config.getString(configName, StringUtils.EMPTY);
}

From source file:com.ihelin.book.db.plugin.MySQLDialect.java

public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit,
        String limitPlaceholder) {
    String limitStr = StringUtils.EMPTY;
    if (StringUtils.isNotBlank(sql)) {
        limitStr = sql + DEF_SQL_LIMIT;//from  w ww.ja  v a  2 s .  c o  m
        if (offset > 0) {
            limitStr += offsetPlaceholder + DEF_SQL_LIMIT_CONNECTOR + limitPlaceholder;
        } else {
            limitStr += limitPlaceholder;
        }
    }
    return limitStr;
}

From source file:me.j360.dubbo.modules.util.concurrent.ThreadUtil.java

/**
 * StackTrace??.// ww w. j  a v a  2  s .  c  o m
 */
public static String getCallerClass() {
    StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();
    if (stacktrace.length >= 4) {
        StackTraceElement element = stacktrace[3];
        return element.getClassName();
    } else {
        return StringUtils.EMPTY;
    }
}

From source file:com.nridge.core.app.mail.Mail.java

/**
 * Convenience method that extracts a first name from an email address
 * formatted as 'first.last@company.com'.  The first name will have its
 * first letter capitalized.//  w  w  w.j av a2s . com
 *
 * @param anEmailAddress Email address.
 *
 * @return Proper first name.
 */
public static String extractFirstName(String anEmailAddress) {
    String firstName = StringUtils.EMPTY;

    if (StringUtils.isNotEmpty(anEmailAddress)) {
        int offset = anEmailAddress.indexOf(StrUtl.CHAR_DOT);
        if (offset > 0)
            firstName = StrUtl.firstCharToUpper(anEmailAddress.substring(0, offset));
        else {
            offset = anEmailAddress.indexOf(StrUtl.CHAR_AT);
            if (offset > 0)
                firstName = StrUtl.firstCharToUpper(anEmailAddress.substring(0, offset));
        }
    }

    return firstName;
}

From source file:com.amalto.core.server.MockStorageAdmin.java

@Override
public Storage get(String storageName, StorageType type) {
    storageName = storageName.replace("#STAGING", StringUtils.EMPTY);
    for (Storage s : storages) {
        if (s.getName().equals(storageName) && s.getType() == type) {
            return s;
        }/*from   w  w  w.  ja v  a2  s .  c o m*/
    }
    return super.get(storageName, type);
}

From source file:com.precioustech.fxtrading.heartbeats.HeartBeatPayLoad.java

public HeartBeatPayLoad(T payLoad) {
    this(payLoad, StringUtils.EMPTY);
}

From source file:ch.cyberduck.binding.HyperlinkAttributedStringFactory.java

/**
 * @param url URL//www  . jav  a 2 s  .co  m
 * @return Clickable and underlined string to put into textfield.
 */
public static NSAttributedString create(final String url) {
    if (null == url) {
        return NSAttributedString.attributedString(StringUtils.EMPTY);
    }
    return create(url, url);
}

From source file:dtu.ds.warnme.app.utils.SecurityUtils.java

public static String hashSHA512Base64(String stringToHash) {
    if (StringUtils.isEmpty(stringToHash)) {
        return StringUtils.EMPTY;
    }//from www .ja  v a  2 s  . c  om
    try {
        byte[] bytes = stringToHash.getBytes(CHARSET_UTF8);
        byte[] md5bytes = DigestUtils.sha512(bytes);
        byte[] base64bytes = Base64.encodeBase64(md5bytes);
        return new String(base64bytes, CHARSET_UTF8);
    } catch (UnsupportedEncodingException e) {
        Log.e(TAG, "This system does not support required hashing algorithms.", e);
        throw new IllegalStateException("This system does not support required hashing algorithms.", e);
    }
}