当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.equals方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringUtils.equals方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.equals方法的具体用法?Java StringUtils.equals怎么用?Java StringUtils.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doAppendMessage

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected Conversation doAppendMessage(Conversation conversation, Message message) {
    final Conversation cc = get(conversation.getId());
    int pos = 0;
    do {
        if (StringUtils.equals(cc.getMessages().get(pos).getId(), message.getId())) {
            break;
        }
        pos++;
    } while (pos < cc.getMessages().size());
    if (pos < cc.getMessages().size()) {
        cc.getMessages().remove(pos);
    }
    cc.getMessages().add(pos, message);
    cc.setLastModified(new Date());
    return cc;
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:18,代码来源:InMemoryStoreService.java

示例2: findRoute

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Find route with request method and path
 *
 * @param path path to request
 * @param httpMethod http method
 * @return Router instance
 */
public Router findRoute(String path, String httpMethod) {

    Router router = routerMap.get(path.concat("::").concat(httpMethod));
    if (router != null) {
        return router;
    }

    router = routerMap.get(path.concat("::").concat(HttpMethod.ALL));
    if (router != null) {
        return router;
    }

    for (Router router1 : routerSet) {
        String routerHttpMethod = router1.getHttpMethod();
        if ((routerHttpMethod.equals(HttpMethod.ALL) || StringUtils.equals(routerHttpMethod, httpMethod)) && router1.match(path)) {
            return router1;
        }
    }

    return null;
}
 
开发者ID:thundernet8,项目名称:Razor,代码行数:29,代码来源:RouteManager.java

示例3: dochangepass

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * <p>
 * 修改密码
 * </p>
 */
private void dochangepass() {
    // TODO 输入检查
    TUser user = userService.getByNo(userno);
    if (StringUtils.equals(user.getPassword(), Utils.convert2MD5(password))) {
        dto.setCode(ReturnCode.FAILED);
        return;
    }

    if (StringUtils.isNotEmpty(password)) {
        user.setPassword(Utils.convert2MD5(password));
    }
    userService.save(user);
    dto.setCode(ReturnCode.SUCCESS);
    // TODO 文字检查和密码校对
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:21,代码来源:AjaxServiceAction.java

示例4: checkDbMap

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Checks that mapped stage physical instnames are nonblank and are different from live physical instnames.
 * Returns silently if ok.
 */
private void checkDbMap()
{
  final String liveLogicalName = liveLogicalDatabase.getLogicalName();
  if (MapUtils.isEmpty(dbMap) || !dbMap.containsKey(liveLogicalName))
  {
    throw new IllegalArgumentException("Live logical database '" + liveLogicalName
        + "' is unmapped, don't know what stage physical instname to create");
  }
  final String stagePhysicalInstanceName = dbMap.get(liveLogicalName);
  if (StringUtils.isBlank(stagePhysicalInstanceName))
  {
    throw new IllegalArgumentException("You have mapped live logical database '" + liveLogicalName
        + "' to a blank string, we don't know what stage physical instname to create");
  }
  if (StringUtils.equals(stagePhysicalInstanceName, livePhysicalDatabase.getInstanceName()))
  {
    throw new IllegalArgumentException("You have mapped live logical database '" + liveLogicalName
        + "' to stage physical instname '" + stagePhysicalInstanceName
        + "', but live physical database is already using that instname");
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:26,代码来源:RdsSnapshotRestoreTask.java

示例5: validateSign

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 一个简单的签名认证,规则:
 * 1. 将请求参数按ascii码排序
 * 2. 拼接为a=value&b=value...这样的字符串(不包含sign)
 * 3. 混合密钥(secret)进行md5获得签名,与请求的签名进行比较
 */
private boolean validateSign(HttpServletRequest request) {
    String requestSign = request.getParameter("sign");//获得请求签名,如sign=19e907700db7ad91318424a97c54ed57
    if (StringUtils.isEmpty(requestSign)) {
        return false;
    }
    List<String> keys = new ArrayList<String>(request.getParameterMap().keySet());
    keys.remove("sign");//排除sign参数
    Collections.sort(keys);//排序

    StringBuilder sb = new StringBuilder();
    for (String key : keys) {
        sb.append(key).append("=").append(request.getParameter(key)).append("&");//拼接字符串
    }
    String linkString = sb.toString();
    linkString = StringUtils.substring(linkString, 0, linkString.length() - 1);//去除最后一个'&'

    String secret = "Potato";//密钥,自己修改
    String sign = DigestUtils.md5Hex(linkString + secret);//混合密钥md5

    return StringUtils.equals(sign, requestSign);//比较
}
 
开发者ID:pandboy,项目名称:pingguopai,代码行数:28,代码来源:WebMvcConfigurer.java

示例6: solrInputField

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static <T> Matcher<SolrInputField> solrInputField(String fieldName, Matcher<T> valueMatcher) {
    return new TypeSafeMatcher<SolrInputField>() {
        @Override
        protected boolean matchesSafely(SolrInputField item) {
            return StringUtils.equals(fieldName, item.getName()) && valueMatcher.matches(item.getValue());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("SolrInputField(")
                    .appendValue(fieldName)
                    .appendText(" value matching ")
                    .appendDescriptionOf(valueMatcher)
                    .appendText(")");
        }
    };
}
 
开发者ID:RBMHTechnology,项目名称:vind,代码行数:18,代码来源:SolrSearchServerTest.java

示例7: apply

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void apply(ApiRequest request, ApiResponse response, WebSocketSession session) {
    String msg = StringEscapeUtils.escapeHtml4(request.getMsg());
    if (StringUtils.isBlank(msg)) {
        return;
    }
    Map<String, Object> attributes = session.getAttributes();
    String id = session.getId();
    DrawPlayerInfo info = ((DrawPlayerInfo) attributes.get("info"));
    DrawGuessContext ctx = (DrawGuessContext) attributes.get("ctx");
    DrawGameStatus status = ctx.status();
    ArrayList<String> msgs = new ArrayList<>(2);
    if (status == DrawGameStatus.RUN) {
        if (StringUtils.equals(id, ctx.getCurrentUser())) {
            protectSecret(info, ctx, msg, msgs);
        } else {
            processGussPerson(info, ctx, msg, msgs);
        }
    } else {
        msgs.add("<b>" + info.getName() + "</b>: " + msg);
    }
    response.setCode(DrawCode.DRAW_MSG.getCode()).setData(msgs);
}
 
开发者ID:csdbianhua,项目名称:telemarket-skittle-alley,代码行数:24,代码来源:UserMsgHandler.java

示例8: normalize

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public String normalize(final String name) {
    if(StringUtils.equals(name, ".")) {
        return finder.find().getAbsolute();
    }
    if(StringUtils.equals(name, "..")) {
        return finder.find().getParent().getAbsolute();
    }
    if(!this.isAbsolute(name)) {
        return String.format("%s%s%s", finder.find().getAbsolute(), PreferencesFactory.get().getProperty("local.delimiter"), name);
    }
    return name;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:13,代码来源:WorkdirPrefixer.java

示例9: judgePriority

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static int judgePriority(String operatorName) {
    if (StringUtils.equals(operatorName, "#")) {
        // 这是一个特殊逻辑,运算栈需要有一个兜底判断的操作符,所以#是RPN默认的一个运算符,但是他不会表现在编译好的语法树里面
        return Integer.MIN_VALUE;
    }
    AlgorithmHolder holder = operatorMaps.get(operatorName);
    return holder.priority;
}
 
开发者ID:virjar,项目名称:sipsoup,代码行数:9,代码来源:OperatorEnv.java

示例10: doFilter

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {
    YiDuConstants.singleBookFlag.set(false);
    HttpServletRequest req = (HttpServletRequest) request;
    String uri = req.getRequestURI();
    if (StringUtils.endsWithAny(uri, "css", "js", "jpg", "png", "gif")) {
        // 静态资源直接跳过
        logger.debug("ignore static resource." + uri);
        chain.doFilter(request, response);
    } else {
        // 非静态资源时,根据具体的信息去做判别,时候需要标识单本
        String rootDomian = YiDuConstants.yiduConf.getString(YiDuConfig.ROOT_DOMAIN);
        String aname = StringUtils.substringBeforeLast(req.getServerName(), "." + rootDomian);
        logger.debug("aname : " + aname);
        if (StringUtils.isNotBlank(aname)) {
            int articleno = SingleBookManager.getArticleno(aname);
            if (articleno != 0) {
                // TODO 即便找到对应的小说,也只做首页和阅读页,其他全部404吧
                Pattern p = Pattern.compile(regex);
                Matcher m = p.matcher(uri);
                boolean matchFlag = false;
                String newURI = "";
                if (m.find()) {
                    // 阅读页
                    newURI = ReaderAction.URL + "?chapterno="
                            + StringUtils.substringBeforeLast(m.group(1), ".html");
                    matchFlag = true;
                } else if (StringUtils.equals(uri, "/") || StringUtils.isEmpty(uri)) {
                    // 首页
                    newURI = InfoAction.URL + "?articleno=" + articleno;
                    matchFlag = true;
                } else {
                    // 返回404
                    YiDuConstants.singleBookFlag.set(true);
                    ((HttpServletResponse) response).sendError(HttpServletResponse.SC_NOT_FOUND);
                }
                logger.debug("newURI str: " + newURI);
                if (matchFlag) {
                    YiDuConstants.singleBookFlag.set(true);
                    YiDuConstants.singleBookServerName.set(req.getServerName());
                    req.getRequestDispatcher(newURI).forward(request, response);
                }
            } else {
                chain.doFilter(request, response);
            }
        } else {
            chain.doFilter(request, response);
        }
    }
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:52,代码来源:SingleBookFilter.java

示例11: parseNode

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private RuleNode parseNode(Node item) throws Exception{

        // 节点非element节点 或 element节点name非rule, 则直接返回
        if (item.getNodeType() != Node.ELEMENT_NODE || !StringUtils.equals(item.getNodeName(), RuleNode.RULE_NODE_NAME)) {
            return null;
        }

        Element ruleNode = (Element) item;

        String table = ruleNode.getAttribute("table");
        String column = ruleNode.getAttribute("column");
        String javaType = ruleNode.getAttribute("javaType");
        KeyColumn keyColumn = new KeyColumn(table, column, javaType);

        String comparator = ruleNode.getAttribute("class");
        Comparator comparatorClass = (Comparator) Class.forName(comparator).newInstance();

        RuleNode node = new RuleNode(keyColumn, comparatorClass);

        NodeList ruleChildren = item.getChildNodes();
        for (int i = 0; i < ruleChildren.getLength(); i++) {

            Optional.ofNullable(parseData(ruleChildren.item(i))).ifPresent(dataNode -> {
                node.add(dataNode);
                dataNode.setRuleNode(node);
            });

        }

        return node;
    }
 
开发者ID:justice-code,项目名称:QiuQiu,代码行数:32,代码来源:XmlDataContext.java

示例12: equals

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean equals(Object obj)
{
  if (obj instanceof ShellResult)
  {
    ShellResult other = (ShellResult) obj;
    return StringUtils.equals(output, other.output) && exitValue == other.exitValue;
  }
  return false;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:11,代码来源:ShellResult.java

示例13: list

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
    try {
        final AttributedList<Path> children = new AttributedList<Path>();
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(directory.getAbsolute());
        if(!f.exists()) {
            throw new NotfoundException(directory.getAbsolute());
        }
        for(File file : fs.getListInDirWithFileFilter(f, TrueFileFilter.TRUE)) {
            final String normalized = PathNormalizer.normalize(file.getAbsolutePath(), true);
            if(StringUtils.equals(normalized, directory.getAbsolute())) {
                continue;
            }
            final PathAttributes attributes = new PathAttributes();
            final ObjStat stats = fs.getObjStat(file.getAbsolutePath());
            attributes.setModificationDate(stats.getModifiedAt().getTime());
            attributes.setCreationDate(stats.getCreatedAt().getTime());
            attributes.setSize(stats.getObjSize());
            attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(stats.getChecksum()))));
            attributes.setOwner(stats.getOwnerName());
            attributes.setGroup(stats.getOwnerZone());
            children.add(new Path(directory, PathNormalizer.name(normalized),
                    file.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file),
                    attributes));
            listener.chunk(directory, children);
        }
        return children;
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Listing directory {0} failed", e, directory);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:34,代码来源:IRODSListService.java

示例14: ScriptRouter

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public ScriptRouter(String type, String rule) {
  super(rule);
  engine = new ScriptEngineManager().getEngineByName(type);
  if (engine == null && StringUtils.equals(type, "javascript")) {
    engine = new ScriptEngineManager().getEngineByName("js");
  }
  if (engine == null) {
    throw new IllegalStateException("Unsupported route rule type: " + type + ", rule: " + rule);
  }
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:11,代码来源:ScriptRouter.java

示例15: getImgUrl

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 获得图片URL
 * 
 * @return 图片URL
 */
public String getImgUrl() {
    String fileName = "";
    if (getImgflag() == null) {
        fileName = "nocover.jpg";
    } else {
        switch (getImgflag()) {
        case 1:
            fileName = getArticleno() + "s.jpg";
            break;
        case 2:
            fileName = getArticleno() + "s.gif";
            break;
        case 3:
            fileName = getArticleno() + "s.png";
            break;
        case 10:
            fileName = getArticleno() + "l.jpg";
            break;
        default:
            fileName = "nocover.jpg";
            break;
        }
    }
    String imgUrl = YiDuConstants.yiduConf.getString(YiDuConfig.RELATIVE_IAMGE_PATH) + "/";
    if (StringUtils.equals("nocover.jpg", fileName)) {
        imgUrl = imgUrl + fileName;
    } else {
        if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CLEAN_IMAGE_URL, false)) {
            imgUrl = imgUrl + getArticleno() / YiDuConstants.SUB_DIR_ARTICLES + "-" + getArticleno() + "-"
                    + Utils.convert2MD5(imgUrl + fileName) + fileName;
        } else {
            imgUrl = imgUrl + getArticleno() / YiDuConstants.SUB_DIR_ARTICLES + "/" + getArticleno() + "/"
                    + fileName;
        }
    }
    return imgUrl;
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:43,代码来源:TArticle.java


注:本文中的org.apache.commons.lang3.StringUtils.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。