Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

1.10.2

Compare
Choose a tag to compare
@venusdrogon venusdrogon released this 02 May 03:21
· 296 commits to master since this release

本次升级共有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(12L, 18);
 User id1_age8 = new User(1L, 8);
 User id2_age30 = new User(2L, 30);
 User id2_age2 = new User(2L, 2);
 User id2_age36 = new User(2L, 36);
 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