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

Releases: ifeilong/feilong-core

1.10.0

26 Dec 03:26
Compare
Choose a tag to compare

本次升级共有34处变更,具体参见 1.10.0 milestone

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

1.特性 🆕

  • none

2.修改

  • 💩 ResourceBundleUtil.getResourceBundle(InputStream) close InputStream fix #588
  • 🎨 update some method param type from Collection to Iterable fix #563
  • 📝 update BeanUtil.populate javadoc fix #561
  • 📝 update error javadoc fix #560

3.移除

  • 🚚 move json function fix #568

  • 🔥 CollectionsUtil remove List<O> removeAll(Collection<O> objectCollection,String propertyName,Collection<V> propertyValueList
    fix #565

  • 🔥 CollectionsUtil remove List<O> removeAll(Collection<O> objectCollection,String propertyName,V...propertyValues) fix #564

  • 🚚 move com.feilong.test pacage to feilong-commons-test fix #578

  • ➖ remove commons-lang:commons-lang fix #576

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.AN fix #585

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.ANS fix #586

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.NUMBER fix #587

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.IP fix #584

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.LETTER_LOWERCASE fix #583

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.LETTER fix #582

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.LETTER_UPPERCASE fix #581

  • 🔥 remove @Deprecated Constants com.feilong.core.RegexPattern.URLLINK fix #580

    上述常量 建议使用的方案参见 RegexPattern 类上的 javadoc

4.Bug 修复 🐛

  • none

1.9.6

05 Dec 04:39
Compare
Choose a tag to compare

具体参见 1.9.6 milestone

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

1.特性 🆕

  • ConvertUtil 添加 Set<T> toSet(T...arrays) 方法 fix #554

    数组转成 Set (LinkedHashSet).

    说明:

    • 此方法返回的是LinkedHashSet

    特别适合:
    如果你要通过以下方式来构造Set:

     Set<String> set = new LinkedHashSet<>();
     set.add("feilong1");
     set.add("feilong2");
     set.add("feilong2");
     set.add("feilong3");

    此时你可以使用:

     Set<String> set = toSet("feilong1", "feilong2", "feilong2", "feilong3");

    代码会更简洁

    甚至于:

    有很多时候,参数需要一个对象Set,构造的时候,你需要这样

     Set<UserAddress> userAddresseSet = new LinkedHashSet<>();
     UserAddress userAddress = new UserAddress();
     userAddress.setAddress("上海");
     userAddresseSet.add(userAddress);

    你可以重构成:

     UserAddress userAddress = new UserAddress();
     userAddress.setAddress("上海");
     Set<UserAddress> userAddresseSet = toSet(userAddress);

2.修改

  • 📝 update javadoc fix #551

3.移除

  • none

4.Bug 修复 🐛

  • none

1.9.5

17 Nov 04:16
Compare
Choose a tag to compare

具体参见 1.9.5 milestone

1.特性 🆕

  • ConvertUtil 添加 Map<K, V> toMap(K key1,V value1,K key2,V value2) 方法 fix #550

    该方法非常适合快速构造一个2个key的Map场景

    比如对于以下代码:

         Map<String, Long> map = new HashMap<>();
         map.put("itemId", itemId);
         map.put("memberId", memberId);
         memberFavoritesDao.findMemberFavoritesByMemberIdAndItemId(map);

    上面4行代码,可以重构成2行:

        Map<String, Long> map = ConvertUtil.toMap("itemId", itemId, "memberId", memberId);
        memberFavoritesDao.findMemberFavoritesByMemberIdAndItemId(map);
  • BeanPredicateUtil 添加 Predicate<T> equalPredicate(Map<String, ?> propertyNameAndPropertyValueMap) 方法 fix #113

    使用示例: 在list中查找 名字是 关羽,并且 年龄是30 的user

    此时你可以:

     User guanyu30 = new User("关羽", 30);
     List<User> list = ConvertUtil.toList(//
                     new User("张飞", 23),
                     new User("关羽", 24),
                     new User("刘备", 25),
                     guanyu30);
    
     Map<String, Object> map = ConvertUtil.toMap("name", "关羽", "age", 30);
    
     User result=com.feilong.core.util.CollectionsUtil.find(list, BeanPredicateUtil.<User> equalPredicate(map));
    
     assertEquals(guanyu30, result);

    寥寥几行代码,就可以搞定

  • BeanPredicateUtil.equalPredicate(String, V) 添加更多的 javadoc fix #546

  • 添加更多的单元测试

2.修改

  • ConvertUtil Map<K, V> toMap(Map.Entry<K, V>...mapEntrys) 方法重命名成 Map<K, V> toMapUseEntrys(Map.Entry<K, V>...mapEntrys) fix #549

3.移除

  • NumberFormatUtil 删除 String format(Number value,String numberPattern) 方法, 请直接调用 NumberUtil String toString(Number value,String toStringPattern) fix #245

4.Bug 修复 🐛

  • ParamUtil.toQueryStringUseArrayValueMap(Map<String, String[]>) 如果 map has value is null,返回 paramName= fix #372

    示例:

            Map<String, String[]> keyAndArrayMap = new LinkedHashMap<>();
    
            keyAndArrayMap.put("province", null);
            keyAndArrayMap.put("city", new String[] { "南通市" });
    
            assertEquals("province=&city=南通市", ParamUtil.toQueryStringUseArrayValueMap(keyAndArrayMap));

1.9.4

03 Nov 07:28
Compare
Choose a tag to compare

detail see in 1.9.4 milestone

特性 🆕

  • add JsonToJavaConfig fix #512
  • add UncapitalizeJavaIdentifierTransformer (Singleton instance) fix #513 thanks 冯明雷
  • add DateJsonValueProcessor.DEFAULT_INSTANCE (Singleton instance) fix #544
  • add BigDecimalJsonValueProcessor.DEFAULT_INSTANCE (Singleton instance) fix #545
  • add SensitiveWordsJsonValueProcessor.INSTANCE (Singleton instance) fix #514
  • Jsonutil add T[] toArray(Object json,JsonToJavaConfig jsonToJavaConfig) fix #517
  • Jsonutil add T toBean(Object json,JsonToJavaConfig jsonToJavaConfig) fix #525 thanks 冯明雷
  • Jsonutil add List<T> toList(Object json,JsonToJavaConfig jsonToJavaConfig) fix #520
  • Jsonutil add Map<String, T> toMap(Object json,JsonToJavaConfig jsonToJavaConfig) fix #523

修改

  • JsonFormatConfig rename to JavaToJsonConfig fix #511
  • Jsonutil update List<T> toList(String json,Class<T> rootClass) to List<T> toList(Object json,Class<T> rootClass)
  • Jsonutil update Map<String, T> toMap(String json) to Map<String, T> toMap(Object json) fix #532

移除

  • remove JsonUtil some method to JsonHelper fix #534

Bug 修复 🐛

  • none

1.9.3

28 Oct 08:12
Compare
Choose a tag to compare

detail see in 1.9.3 milestone

特性 🆕

  • JsonFormatConfig add jsonTargetClassAndPropertyNameProcessorMap property, fix #505

  • add CapitalizePropertyNameProcessor

    JsonUtil 将对象转成json 字符串的时候,支持修改属性名称

    下面是使用示例:

    我们这边的代码

     public class CrmAddpointCommand{
    
         // 用户编码
         private String openId;
    
         // 渠道:Tmall - 天猫 JD - 京东
         private String consumptionChannel;
    
         // 淘宝/京东买家账号
         private String buyerId;
    
         // 电商订单编号 
         private String orderCode;
    
         // setter getter
     }

    符合标准的java代码规范,如果直接使用 com.feilong.tools.jsonlib.JsonUtil.format(Object)

     public void testJsonTest(){
         CrmAddpointCommand crmAddpointCommand = new CrmAddpointCommand();
    
         crmAddpointCommand.setBuyerId("123456");
         crmAddpointCommand.setConsumptionChannel("feilongstore");
         crmAddpointCommand.setOpenId("feilong888888ky");
         crmAddpointCommand.setOrderCode("fl123456");
    
         LOGGER.debug(JsonUtil.format(crmAddpointCommand));
     }

    输出结果:

     {
     "orderCode": "fl123456",
     "buyerId": "123456",
     "consumptionChannel": "feilongstore",
     "openId": "feilong888888ky"
     }

    输出的属性大小写和 crmAddpointCommand 对象里面字段的大小写相同,但是对方接口要求首字符要大写:

    此时,你可以使用

     public void testJsonTest(){
         CrmAddpointCommand crmAddpointCommand = new CrmAddpointCommand();
    
         crmAddpointCommand.setBuyerId("123456");
         crmAddpointCommand.setConsumptionChannel("feilongstore");
         crmAddpointCommand.setOpenId("feilong888888ky");
         crmAddpointCommand.setOrderCode("fl123456");
    
         //****************************************************************************************
    
         JsonFormatConfig jsonFormatConfig = new JsonFormatConfig();
    
         Map<Class<?>, PropertyNameProcessor> targetClassAndPropertyNameProcessorMap = newHashMap(1);
         targetClassAndPropertyNameProcessorMap.put(CrmAddpointCommand.class, CapitalizePropertyNameProcessor.INSTANCE);
    
         jsonFormatConfig.setJsonTargetClassAndPropertyNameProcessorMap(targetClassAndPropertyNameProcessorMap);
    
         LOGGER.debug(JsonUtil.format(crmAddpointCommand, jsonFormatConfig));
     }

    输出结果:

     {
     "OrderCode": "fl123456",
     "BuyerId": "123456",
     "ConsumptionChannel": "feilongstore",
     "OpenId": "feilong888888ky"
     }
    

修改

  • update javadoc fix #508

移除

  • none

Bug 修复 🐛

  • RegexPattern update MOBILEPHONE regex pattern to ^1[34578]\\d{9}$ fix #506,更多说明参见 javadoc

1.9.2

24 Oct 06:20
Compare
Choose a tag to compare

detail see in 1.9.2 milestone

[Feature] 🆕

  • ConvertUtil add Map<I, J> toMap(Map<K, V> inputMap,final Transformer<K,I> keyTransformer, final Transformer<V, J> valueTransformer) fix #497
  • ConvertUtil add Map<I, J> toMap(Map<K, V> inputMap,final Class<I> keyTargetType,final Class<J> valueTargetType) fix #497
  • add SimpleClassTransformer

example:

if you have a map that is Map<String, String>,want to change to Map<Integer, Integer>

you can use:

Map<String, String> map = toMap("1", "2");
Map<Integer, Integer> returnMap = toMap(map, Integer.class, Integer.class);

 // 输出测试
 for (Map.Entry<Integer, Integer> entry : returnMap.entrySet()){
     Integer key = entry.getKey();
     Integer value = entry.getValue();
     LOGGER.debug("key:[{}],value:[{}]", key, value);
 }

output :

key:[1],value:[2]

[Update]

  • FieldUtil T getFieldValue(Object obj,String fieldName) update to private, fix #493,fix #494
  • ClassLoaderUtil update ClassLoaderUtil.getResourceInAllClassLoader(String, Class<?>) log level, fix #476

[Remove]

  • ConstructorUtil remove T newInstance(String className,Object...parameterValues) fix #486
  • ClassLoaderUtil remove getRootClassPath(ClassLoader classLoader) method fix #477

[Fix Bug] 🐛

  • List<Field> getAllFieldList(final Class<?> klass,String...excludeFieldNames) if klass is null, expect NPE,but IllegalArgumentException fix #495
  • update JsonUtil Map<String, T> toMap(String json,Class<T> rootClass) error javadoc fix #466
  • JsonUtil.toMap(String, Class<T>, Map<String, Class<?>>) return type change LinkedHashMap instead of HashMap, fix #464

1.9.1

19 Sep 09:24
Compare
Choose a tag to compare

detail see in 1.9.1 milestone

[Feature] 🆕

  • none

[Update]

  • none

[Remove]

  • none

[Fix Bug] 🐛

  • ParamUtil String addParameterSingleValueMap(String uriString,Map<String, String> singleValueMap,String charsetType) if map is null ,same as empty map fix #460
  • ParamUtil String addParameterArrayValueMap(String uriString,Map<String, String[]> arrayValueMap,String charsetType) if map is null ,same as empty map fix #461

1.9.0

18 Sep 08:11
Compare
Choose a tag to compare

detail see in 1.9.0 milestone

[Feature] 🆕

  • none

[Update]

  • update some javadoc
  • add some test
  • BeanUtil update void setProperty(Object bean,String propertyName,Object value) to private fix #438
  • BeanUtil update String getProperty(Object bean,String propertyName) to private fix #437
  • ParamUtil update String addParameter(String uriString,String paramName,Object parameValue,String charsetType) parameValue type from Object to String fix #448

[Remove]

  • ParamUtil remove String toSafeQueryString(Map<String, String[]> arrayValueMap,String charsetType) fix #454
  • BeanUtil remove void initConverters() fix #440
  • BeanUtil remove void register(Converter converter,Class<?> klass) fix #446,fix #447

[Fix Bug] 🐛

  • ParamUtil.addParameterArrayValueMap(String, Map<String,String[]>, String) if arrayValueMap is null will throw NPE fix #451
  • ParamUtil String addParameterSingleValueMap(String uriString,Map<String, String> singleValueMap,String charsetType) if singleValueMap is null,will throw NPE fix #449

1.8.8

07 Sep 14:37
Compare
Choose a tag to compare

detail see in 1.8.8 milestone

[Feature] 🆕

  • CollectionsUtil add Map<T, List<O>> group(Collection<O> objectCollection,Transformer<O, T> keyTransformer) fix #270 thanks @ananbeike
  • CollectionsUtil add Map<T, List<O>> group( Collection<O> objectCollection,Predicate<O> includePredicate,Transformer<O, T> keyTransformer) fix #270 thanks @ananbeike

[Update]

  • update some javadoc
  • add some test
  • ResourceBundleUtil change T readToAliasBean(ResourceBundle resourceBundle,Class<T> aliasBeanClass) to T toAliasBean(ResourceBundle resourceBundle,Class<T> aliasBeanClass) fix #423
  • ResourceBundleUtil change Properties toProperties(ResourceBundle resourceBundle) to Properties readToProperties(String baseName)
  • ResourceBundleUtil change ResourceBundleUtil.readToMap method to ResourceBundleUtil.toMap method

[Remove]

  • ResourceBundleUtil remove String getValue(String baseName,String key,Object...arguments) fix #410
  • ResourceBundleUtil remove String getValue(String baseName,Locale locale,String key,Object...arguments) fix #411 fix #407, fix #408
  • RandomUtil remove long createRandom(Number minInclusiveValue,Number maxExclusiveValue) fix #395
  • RandomUtil remove String createRandomFromString(String str,int minLength,int maxLength) method ,fix #394
  • RandomUtil remove long createRandom(Number maxValue) fix #296
  • AggregateUtil remove T getMinValue(Map<K, T> map,K...keys) fix #347,fix #135
  • ConvertUtil remove Map<String, String> toMap(ResourceBundle resourceBundle) fix #426

[Fix Bug] 🐛

  • none

1.8.7

29 Aug 10:27
Compare
Choose a tag to compare

detail see in 1.8.7 milestone

[Feature] 🆕

  • none

[Update]

  • update some javadoc
  • add some test
  • SortUtil use new method name fix #366

[Remove]

  • none

[Fix Bug] 🐛

  • if URLUtil URI toURI(URL url) if url is null, will return null instead of NPE, fix #367