设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

feilong-core 1.10.2,让Java开发更简便的工具包

2017-5-2 19:10| 发布者: joejoe0332| 查看: 775| 评论: 0|原作者: oschina|来自: oschina

摘要: feilong-core 1.10.2 发布了。feilong-core 是一个让 Java 开发更简便的工具包,可以让你从大量重复的底层代码中脱身,提高工作效率; 让你的代码更简炼,易写、易读、易于维护;本次升级共有13处变更,具体参见1.10.2 mi ...

feilong-core 1.10.2 发布了。feilong-core 是一个让 Java 开发更简便的工具包, 可以让你从大量重复的底层代码中脱身,提高工作效率; 让你的代码更简炼,易写、易读、易于维护;

本次升级共有13处变更,具体参见 1.10.2 milestone

1.10.2 文档地址: http://feilong-core.mydoc.io/

1.特性 

  • CollectionsUtil 添加 void forEach(final Iterable<O> beanIterable,String propertyName,Object propertyValue) 方法

可以统一修改 集合里面指定属性的值 see #606

对于以下购物车全选的代码:

 //找到需要处理的对象list
List<ShoppingCartLineCommand> toDoNeedChangeCheckedCommandList = select(
                 needChangeCheckedCommandList,
                 toggleCheckStatusShoppingCartLinePredicateBuilder.build(shoppingCartLineCommandList, checkStatus));
// 将状态修改成对应状态
for (ShoppingCartLineCommand shoppingCartLineCommand : toDoNeedChangeCheckedCommandList){
     shoppingCartLineCommand.setSettlementState(1);
 }

此时你还可以:

 //找到需要处理的对象list
List<ShoppingCartLineCommand> toDoNeedChangeCheckedCommandList = select(
                 needChangeCheckedCommandList,
                 toggleCheckStatusShoppingCartLinePredicateBuilder.build(shoppingCartLineCommandList, checkStatus));
// 将状态修改成对应状态
CollectionsUtil.forEach(toDoNeedChangeCheckedCommandList, "settlementState"1);
  • SortUtil.sortListByPropertyNamesValue 支持倒序排序 fix #608

场景: 将user list 先按照 id desc 再按照 age asc 进行排序

User id12_age18 = new User(12L18);
User id1_age8 = new User(1L8);
User id2_age30 = new User(2L30);
User id2_age2 = new User(2L2);
User id2_age36 = new User(2L36);
List<User> list = toList(id12_age18, id2_age36, id2_age2, id2_age30, id1_age8);

 sortListByPropertyNamesValue(list, "id desc""age");

 assertThat(list, contains(id12_age18, id2_age2, id2_age30, id2_age36, id1_age8));
  • BeanComparatorUtil.propertyComparator(String) 支持倒序排序 #612

  • BeanComparatorUtil.chainedComparator(String...) 支持倒序还是顺序 #609

  • 新建 SortHelper #611

2.修改

  • BeanComparatorUtil.chainedComparator(String...) 如果是单值,那么直接使用 propertyComparator 返回 #615

3.移除

  • none

4.Bug 修复 

  • BeanComparatorUtil.chainedComparator(String...) 如果属性名称的属性值有null的情况会出现空指针 fix #620

  • 修改 BeanComparatorUtil.propertyComparator(String, V...)和 BeanComparatorUtil.propertyComparator(String, List<V>)泛型的顺序 fix #618


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部