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

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

Introduction

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

Prototype

public static boolean equals(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal.

Usage

From source file:com.intel.cosbench.driver.iterator.EmptyIterator.java

public static EmptyIterator parse(String pattern) {
    if (!StringUtils.equals(pattern, "r(0,0)") && !StringUtils.equals(pattern, "0-0"))
        return null;
    return new EmptyIterator();
}

From source file:com.zb.app.biz.cons.TravelNewsTypeEnum.java

public static TravelNewsTypeEnum getAction(String name) {
    for (TravelNewsTypeEnum type : values()) {
        if (StringUtils.equals(name, type.name))
            return type;
    }/*from  w  ww . ja v  a  2 s  . c  om*/
    return null;
}

From source file:com.intel.cosbench.driver.operator.Operators.java

private static AbstractOperator createOperator(String type) {
    if (StringUtils.equals(type, Reader.OP_TYPE))
        return new Reader();
    if (StringUtils.equals(type, Writer.OP_TYPE))
        return new Writer();
    if (StringUtils.equals(type, FileWriter.OP_TYPE))
        return new FileWriter();
    if (StringUtils.equals(type, Preparer.OP_TYPE))
        return new Preparer();
    if (StringUtils.equals(type, Cleaner.OP_TYPE))
        return new Cleaner();
    if (StringUtils.equals(type, Initializer.OP_TYPE))
        return new Initializer();
    if (StringUtils.equals(type, Disposer.OP_TYPE))
        return new Disposer();
    if (StringUtils.equals(type, Deleter.OP_TYPE))
        return new Deleter();
    String msg = "unrecognized operation: " + type;
    throw new ConfigException(msg);
}

From source file:com.mmj.app.biz.cons.BooleanEnum.java

public static BooleanEnum getByName(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }//w ww. j a  va  2s .  c o  m
    for (BooleanEnum state : values()) {
        if (StringUtils.equals(state.getName(), name)) {
            return state;
        }
    }
    return null;
}

From source file:com.adobe.acs.commons.rewriter.impl.SaxElementUtils.java

public static boolean isCss(final String elementName, final Attributes attrs) {
    final String type = attrs.getValue("", "type");
    final String href = attrs.getValue("", "href");

    if (StringUtils.equals("link", elementName) && StringUtils.equals(type, CSS_TYPE)
            && StringUtils.startsWith(href, "/") && !StringUtils.startsWith(href, "//")
            && StringUtils.endsWith(href, LibraryType.CSS.extension)) {
        return true;
    }/*from  ww  w  . j ava  2  s .com*/

    return false;
}

From source file:com.xx_dev.apn.proxy.ApnProxyLocalAddressChooser.java

public static String choose(String hostName) {

    for (ApnProxyLocalIpRule localIpRule : ApnProxyConfig.getConfig().getLocalIpRuleList()) {
        for (String originalHost : localIpRule.getOriginalHostList()) {
            if (StringUtils.equals(originalHost, hostName)
                    || StringUtils.endsWith(hostName, "." + originalHost)) {
                return localIpRule.getLocalIp();
            }//  w  w  w. j  av  a  2s  .com
        }
    }

    return null;
}

From source file:com.openteach.diamond.address.Protocol.java

/**
 * //from   w w w .  ja v a 2s .c o  m
 * @param protocol
 * @return
 */
public static final Protocol toEnum(String protocol) {
    for (Protocol p : Protocol.values()) {
        if (StringUtils.equals(p.name, protocol)) {
            return p;
        }
    }
    return null;
}

From source file:cn.cuizuoli.appranking.enumeration.Country.java

/**
 * getObject/*from w ww  .  j  av  a2s. c om*/
 * @param code
 * @return
 */
public static Country getObject(String code) {
    for (Country country : Country.values()) {
        if (StringUtils.equals(country.getCode(), code)) {
            return country;
        }
    }
    return null;
}

From source file:com.junly.common.enums.HttpChannelType.java

/**
 * /* ww  w  .ja  va2s. c o m*/
 * 
 * @param code
 * @return
 */
public static HttpChannelType getEnumByCode(String code) {

    if (StringUtils.isNotBlank(code)) {
        for (HttpChannelType activitie : HttpChannelType.values()) {
            if (StringUtils.equals(code, activitie.getCode())) {
                return activitie;
            }
        }
    }
    return null;
}

From source file:cn.cuizuoli.appranking.enumeration.Category.java

/**
 * getObject/*from  w  ww  . j a  va 2 s . co m*/
 * @param code
 * @return
 */
public static Category getObject(String code) {
    for (Category category : Category.values()) {
        if (StringUtils.equals(category.getCode(), code)) {
            return category;
        }
    }
    return null;
}