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.zb.app.biz.cons.ColumnCatEnum.java

public static ColumnCatEnum getAction(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }//from  w  ww . j av  a 2  s  . c om
    for (ColumnCatEnum type : values()) {
        if (StringUtils.equals(name, type.name))
            return type;
    }
    return null;
}

From source file:com.htmlhifive.tools.codeassist.core.config.ConfigFileParserFactory.java

/**
 * ???.<br>/* w  w  w .  j a va 2s.  c  om*/
 * ????????null?.
 * 
 * @param is .
 * @param fileExtension ??.
 * @return .
 * @throws ParseException ?.
 */
public static ConfigFileParser createParser(InputStream is, String fileExtension) throws ParseException {

    if (StringUtils.equals(fileExtension, H5CodeAssistCorePluginConst.EXTENTION_XML)) {
        return new XmlConfigCodeAssistParser(is);
    }

    return null;
}

From source file:com.gantzgulch.sharing.matchers.UserMatcher.java

public static Matcher<List<User>> containsUsername(final String username) {
    return new BaseMatcher<List<User>>() {

        @Override/*w w w .  ja  va2 s  .  co m*/
        public boolean matches(Object arg0) {
            List<User> users = Cast.cast(arg0);
            return Iterables.any(users, new Predicate<User>() {
                @Override
                public boolean apply(User input) {
                    return StringUtils.equals(input.getUsername(), username);
                }
            });
        }

        @Override
        public void describeTo(Description arg0) {
            arg0.appendText("User with username : " + username);
        }
    };
}

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

public static String getDetailByCode(String code) {

    if (StringUtils.isNotBlank(code)) {
        for (HttpChannelType activitie : HttpChannelType.values()) {
            if (StringUtils.equals(code, activitie.getCode())) {
                return activitie.getDetail();
            }/* w ww . java2s  . c o  m*/
        }
    }
    return null;
}

From source file:com.ms.commons.utilities.StaticContentDeploy.java

public static synchronized void init() {
    String staticVersion = getStaticVersion();
    if (StringUtils.isBlank(staticVersion) || StringUtils.equals(staticVersion, "0")
            || !staticVersion.matches("\\d+")) {
        staticVersion = StringUtils.EMPTY;
    }//from  w  w w  .  j a va2 s  .  com
    StaticContentDeploy.jsVersion = staticVersion;
    StaticContentDeploy.imgVersion = staticVersion;
    StaticContentDeploy.cssVersion = staticVersion;
}

From source file:com.ms.app.web.commons.tools.StaticsTools.java

public static String getVersion() {
    if (!StringUtils.equals(SystemInfos.getMode(), "run")) {
        return "";
    }/*  w ww .  ja  va 2s.  com*/
    return randomStaticVersion;
}

From source file:com.hangum.tadpole.commons.utils.zip.util.ZipUtils.java

/**
 * //from ww w.j  a v a2s .co m
 * @param base_dir
 * @param zipFile
 * @return
 * @throws Exception
 */
public static String pack(String base_dir, String zipFile) throws Exception {
    String zipFullPath = PublicTadpoleDefine.TEMP_DIR + zipFile + ".zip";
    ZipUtil.pack(new File(base_dir), new File(zipFullPath), new NameMapper() {
        public String map(String name) {
            try {
                if (!StringUtils.equals(name, StringEscapeUtils.escapeJava(name))) {
                    name = "download_files" + StringUtils.substring(name, StringUtils.lastIndexOf(name, '.'));
                }
                name = new String(name.getBytes(), "UTF-8");
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return name;
        }
    });

    return zipFullPath;
}

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

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

    if (StringUtils.equals("script", elementName) && StringUtils.equals(type, JS_TYPE)
            && StringUtils.startsWith(src, "/") && !StringUtils.startsWith(src, "//")
            && StringUtils.endsWith(src, LibraryType.JS.extension)) {
        return true;
    }//from w  ww  .j  a v a  2 s  .  co m

    return false;
}

From source file:cn.cuizuoli.appranking.util.DateRangeUtil.java

/**
 * getDayListOfMonth//from   ww  w.  ja v a  2s  .c o  m
 * @param month
 * @return
 */
public static List<String> getDayListOfMonth(String month) {
    List<String> dateList = new ArrayList<String>();
    DateTime datetime = DateUtil.fromMonth(month).withDayOfMonth(1);
    while (StringUtils.equals(DateUtil.toMonth(datetime), month)) {
        dateList.add(DateUtil.toDay(datetime));
        datetime = datetime.plusDays(1);
    }
    return dateList;
}

From source file:com.ms.commons.security.SecurityUtilsTest.java

public void testMD5() {
    String sourcePassword = "abc123...@&*(_)(&^%$!~..../";
    for (int i = 0; i < 1000; i++) {
        String a1 = SecurityUtils.createMD5(sourcePassword);
        String a2 = SecurityUtils.createMD5(sourcePassword);
        assertTrue(StringUtils.equals(a1, a2));
    }//  w  w  w.ja  v  a  2s .co  m
}