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

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

Introduction

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

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

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

Usage

From source file:kirchnerei.glatteis.page.ui.MenuRole.java

public static MenuRole fromString(String role) {
    if (StringUtils.isEmpty(role)) {
        return MENU_PARTIAL;
    }//  w  w w  . jav a  2 s . c om
    if (role.equals("as-partial") || role.equals("partial")) {
        return MENU_PARTIAL;
    } else if (role.equals("as-dialog") || role.equals("dialog")) {
        return MENU_DIALOG;
    }
    try {
        return valueOf(role.toUpperCase());
    } catch (Exception e) {
        return MENU_PARTIAL;
    }
}

From source file:AIR.Common.Web.WebHelper.java

public static int getQueryValueInt(String name) {
    String value = getQueryString(name);
    if (StringUtils.isEmpty(value))
        return 0;
    return Integer.parseInt(value);
}

From source file:com.microsoft.alm.common.utils.ArgumentHelper.java

public static void checkNotEmptyString(final String arg, final String argName) {
    if (StringUtils.isEmpty(arg)) {
        throw new IllegalArgumentException(String.format(EMPTY_ARG_MSG, argName));
    }/*w  ww. j a  v  a  2  s  .c o m*/
}

From source file:com.bstek.dorado.util.clazz.TypeInfo.java

public static TypeInfo parse(String className) throws ClassNotFoundException {
    if (StringUtils.isEmpty(className)) {
        return null;
    }/*from  ww w  .j a  v a2 s .  co m*/

    String typeName = null;
    boolean aggregated = false;
    Matcher matcher = AGGREGATION_PATTERN_1.matcher(className);
    if (matcher.matches()) {
        typeName = matcher.group(2);
        aggregated = true;
    } else {
        matcher = AGGREGATION_PATTERN_2.matcher(className);
        if (matcher.matches()) {
            typeName = matcher.group(1);
            aggregated = true;
        }
    }
    if (typeName == null) {
        typeName = className;
    }

    return new TypeInfo(ClassUtils.forName(typeName), aggregated);
}

From source file:com.cloudera.nav.sdk.client.QueryUtils.java

/**
 * Makes a conjunctive "AND" Solr query with two clauses.
 *
 * @param q1 Solr query string//from  w w  w .  ja va2  s .  c om
 * @param q2 Solr query string
 * @return (q1) AND (q2)
 */
public static String conjoinSolrQueries(String q1, String q2) {
    if (StringUtils.isEmpty(q1)) {
        return q2;
    }
    if (StringUtils.isEmpty(q2)) {
        return q1;
    }
    return q1 + " AND " + q2;
}

From source file:com.cognifide.actions.core.util.Utils.java

public static String propertyToString(ComponentContext ctx, String name, String defaultValue) {
    Object object = ctx.getProperties().get(name);
    String value = PropertiesUtil.toString(object, defaultValue);
    return StringUtils.isEmpty(value) ? defaultValue : value;
}

From source file:com.floreantpos.model.PaymentStatusFilter.java

public static PaymentStatusFilter fromString(String s) {
    if (StringUtils.isEmpty(s)) {
        return OPEN;
    }//from  w ww.  ja  v  a  2  s.  co  m

    try {
        PaymentStatusFilter filter = valueOf(s);
        return filter;
    } catch (Exception e) {
        return OPEN;
    }
}

From source file:kirchnerei.glatteis.page.ui.NotifyKind.java

public static NotifyKind fromString(String kind) {
    if (StringUtils.isEmpty(kind)) {
        return INFO;
    }/*w w w. j  a v a  2s  .  co m*/
    try {
        return valueOf(kind.toUpperCase());
    } catch (Exception e) {
        return INFO;
    }
}

From source file:com.openshift.internal.util.URIUtils.java

public static Map<String, String> splitFragment(String location) {
    if (StringUtils.isEmpty(location)) {
        return Collections.emptyMap();
    }/*from   w w w.  jav  a2  s  . c o  m*/
    URI uri = null;
    try {
        uri = new URI(location);
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
    return splitFragment(uri);
}

From source file:com.bstek.dorado.core.io.ResourceUtils.java

/**
 * ???? '/'/*ww  w . ja  v a 2  s  .c o  m*/
 */
public static String concatPath(String path1, String path2) {
    String result;
    if (StringUtils.isEmpty(path1)) {
        result = path2;
    } else {
        result = path1;
        if (StringUtils.isNotEmpty(path2)) {
            char c1 = path1.charAt(path1.length() - 1), c2 = path2.charAt(0);
            boolean b1 = (c1 == '\\' || c1 == '/'), b2 = (c2 == '\\' || c2 == '/');
            if (!b1 && !b2) {
                result += '/';
            } else if (b1 && b2) {
                path2 = path2.substring(1);
            }
            result += path2;
        }
    }
    return result;
}