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

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

Introduction

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

Prototype

public static boolean equals(final CharSequence cs1, final CharSequence cs2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters.

null s are handled without exceptions.

Usage

From source file:com.ykun.commons.utils.security.MD5Utils.java

/**
 * MD5//from   ww w . j  av a 2  s .  c  o  m
 *
 * @param orign  
 * @param secret 
 * @return
 */
public static boolean check(String orign, String secret) {
    return StringUtils.equals(md5(orign), secret);
}

From source file:controllers.modules.opinionMiners.base.OpinionMiner.java

public static <T extends OpinionMiner> Class<? extends T> findSubMiner(String code, Class<T> minerBase) {
    for (Class<? extends T> subMiner : getSubMiners(minerBase)) {
        Coded coded = subMiner.getAnnotation(Coded.class);
        if (coded != null && StringUtils.equals(code, coded.value())) {
            return subMiner;
        }//from   w  w w. j  a v  a  2  s  .c  om
    }

    return null;
}

From source file:com.glaf.shiro.SecurityConfig.java

public static boolean eq(String key, String value) {
    if (key != null && value != null) {
        String x = filterChainDefinitionMap.get(key);
        if (StringUtils.equals(value, x)) {
            return true;
        }/*from ww w  .  j  a va  2  s . c o m*/
    }
    return false;
}

From source file:dtu.ds.warnme.app.ws.client.restful.UpdateRestClientOnPreferenceChangeListener.java

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    if (StringUtils.equals(key, Prefs.Keys.SERVER_HOST) || StringUtils.equals(key, Prefs.Keys.SERVER_PORT)
            || StringUtils.equals(key, Prefs.Keys.USER_USERNAME)
            || StringUtils.equals(key, Prefs.Keys.USER_PASSWORD_HASH)
            || StringUtils.equals(key, Prefs.Keys.SERVER_REALM)) {
        RestClientHolder.updateRestClient();
    }/*from   w w w.ja  v a2  s  . c o  m*/

}

From source file:com.mirth.connect.client.ui.ChannelTableNameEntry.java

@Override
public int compareTo(ChannelTableNameEntry entry) {
    if (entry == null) {
        return 1;
    }//  w w w . j av  a  2  s.co  m
    if (StringUtils.equals(name, ChannelGroup.DEFAULT_NAME)) {
        return -1;
    } else if (StringUtils.equals(entry.getName(), ChannelGroup.DEFAULT_NAME)) {
        return 1;
    }
    return name.compareToIgnoreCase(entry.getName());
}

From source file:it.scoppelletti.mobilepower.types.StringTools.java

/**
 * Verifica se due stringhe sono uguali.
 * //from  w ww . j  a  v  a2  s  .  c  o  m
 * <P>Il metodo {@code equals} della classe statica {@code Strings}
 * pu&ograve; essere pi&ugrave; comodo da usare della coppia di metodi
 * {@code equals} e {@code equalsIgnoreCase} della classe {@code String}
 * quando l&rsquo;indicatore per ignorare o meno la differenza tra i
 * caratteri maiuscoli e minuscoli &egrave; un parametro variabile.</P>
 * 
 * @param s1         Prima stringa. Pu&ograve; essere {@code null}.
 * @param s2         Seconda stringa. Pu&ograve; essere {@code null}.
 * @param ignoreCase Indica se ignorare la differenza tra caratteri
 *                   maiuscoli e minuscoli.
 * @return           Esito della verifica.
 */
public static boolean equals(String s1, String s2, boolean ignoreCase) {
    if (ignoreCase) {
        return StringUtils.equalsIgnoreCase(s1, s2);
    }

    return StringUtils.equals(s1, s2);
}

From source file:com.cognifide.aet.executor.xmlparser.xml.utils.ValidationUtils.java

public static String validateNotHavingUnderscore(String value, String warnMessage) throws ParseException {
    String fixedValue = StringUtils.remove(value, "_");

    if (!StringUtils.equals(value, fixedValue)) {
        LOGGER.warn(warnMessage);/*from  w  w  w .  j a  v a 2  s  .c o m*/
    }

    return fixedValue;
}

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

/**
 *
 * @param node JCR node//from   ww  w  .  java2 s .  c om
 * @param propName property name
 * @param propValue property value
 * @throws RepositoryException -
 */
public static void updateProperty(final Node node, final String propName, final String propValue)
        throws RepositoryException {
    boolean hasProperty = node.hasProperty(propName);

    if (!hasProperty && propValue != null) {
        updateStringProperty(node, propName, propValue);
    } else if (hasProperty && propValue == null) {
        updateStringProperty(node, propName, null);
    } else if (hasProperty && !StringUtils.equals(propValue, node.getProperty(propName).getString())) {
        updateStringProperty(node, propName, propValue);
    }
}

From source file:com.glaf.core.config.CustomProperties.java

public static boolean eq(String key, String value) {
    if (key != null && value != null) {
        String x = properties.getProperty(key);
        if (StringUtils.equals(value, x)) {
            return true;
        }//from   w w w  . j a v  a 2s . c  o m
    }
    return false;
}

From source file:com.mirth.connect.server.logging.MirthLog4jFilter.java

@Override
public int decide(LoggingEvent event) {
    // This check is done to filter out SAXParser warnings introduced in 7u40 (MIRTH-3548)
    if (event.getLevel().equals(Level.ERROR) && event.getLoggerName().equals(LOGGER_NAME)) {
        String msg = event.getRenderedMessage();

        if (StringUtils.isNotBlank(msg)) {
            if (StringUtils.equals(msg, "Compiler warnings:") || StringUtils.contains(msg,
                    "Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.")
                    || StringUtils.contains(msg,
                            "Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.")
                    || StringUtils.contains(msg,
                            "Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.")) {
                return Filter.DENY;
            }// w  w w.  j av a 2s  .c o  m
        }
    }

    return Filter.NEUTRAL;
}