Skip to content

Commit

Permalink
Prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
looly committed Jan 31, 2019
2 parents b8c0157 + 93198a4 commit a9889cc
Show file tree
Hide file tree
Showing 54 changed files with 567 additions and 261 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@

-------------------------------------------------------------------------------------------------------------

## 4.4.4

### 新特性
* 【crypto】 增加EC公钥压缩/解压缩(pr#264@Github)
* 【db】 Entity支持IS NOT NULL形式,调整逻辑,强化Condition的toString(issue#267@Github)

### Bug修复
* 【core】 修复Profile中路径参数失效问题(issue#265@Github)
* 【core】 修复Profile中路径参数失效问题
* 【core】 修复MapConvert中值类型转换错误的问题(issue#268@Github)

-------------------------------------------------------------------------------------------------------------

## 4.4.3

### 新特性
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ Hutool是Hu + tool的自造词,谐音“糊涂”,寓意追求“万事都
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</dependency>
```

### Gradle
```
compile 'cn.hutool:hutool-all:4.4.3'
compile 'cn.hutool:hutool-all:4.4.4'
```

### 非Maven项目

点击以下任一链接,下载`hutool-all-X.X.X.jar`即可:

- [Maven中央库1](https://repo1.maven.org/maven2/cn/hutool/hutool-all/4.4.3/)
- [Maven中央库2](http://repo2.maven.org/maven2/cn/hutool/hutool-all/4.4.3/)
- [Maven中央库1](https://repo1.maven.org/maven2/cn/hutool/hutool-all/4.4.4/)
- [Maven中央库2](http://repo2.maven.org/maven2/cn/hutool/hutool-all/4.4.4/)

> 注意
> Hutool只支持JDK7+,对应Android平台没有测试,部分方法并不支持。
Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="js-fullheight-home fh5co-copy-inner">
<h1>
<b style="font-size: 180%;margin-left:-10px">Hutool</b>
<span style="font-size: 35%">v4.4.3</span>
<span style="font-size: 35%">v4.4.4</span>
</h1>
<h2>A set of tools that keep Java sweet.</h2>
<div style="margin-top: 100px">
Expand Down Expand Up @@ -143,12 +143,12 @@ <h2>A set of tools that keep Java sweet.</h2>
<code>&lt;dependency&gt;
&lt;groupId&gt;cn.hutool&lt;/groupId&gt;
&lt;artifactId&gt;hutool-all&lt;/artifactId&gt;
&lt;version&gt;4.4.3&lt;/version&gt;
&lt;version&gt;4.4.4&lt;/version&gt;
&lt;/dependency&gt;</code>
</pre>
<div>Gradle:</div>
<pre style="background: none; padding: 0;margin: 0;border: none;">
<code>compile 'cn.hutool:hutool-all:4.4.3'</code>
<code>compile 'cn.hutool:hutool-all:4.4.4'</code>
</pre>
<p>
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22hutool-all%22" class="btn btn-primary btn-outline" target="_blank">从Maven安装</a>
Expand Down
2 changes: 1 addition & 1 deletion hutool-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-all</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-aop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-aop</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-bloomFilter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-bloomFilter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-cache</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-captcha</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
</parent>

<artifactId>hutool-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ public static <T> Collection<T> addAll(Collection<T> collection, Object value, T
elementType = Object.class;
} else {
final Class<?> elementRowType = TypeUtil.getClass(elementType);
if (elementRowType.isInstance(value) && false == Iterable.class.isAssignableFrom(elementRowType)) {
if (null != elementRowType && (elementRowType.isInstance(value) && false == Iterable.class.isAssignableFrom(elementRowType))) {
// 其它类型按照单一元素处理
collection.add((T) value);
return collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,22 @@ public <T> T convert(Type type, Object value, T defaultValue, boolean isCustomFi
if (null == type) {
type = defaultValue.getClass();
}
final Class<T> rowType = (Class<T>) TypeUtil.getClass(type);
Class<T> rowType = (Class<T>) TypeUtil.getClass(type);
if(null == rowType) {
if(null != defaultValue) {
rowType = (Class<T>) defaultValue.getClass();
}else {
//无法识别的泛型类型,按照Object处理
return (T) value;
}
}

// 特殊类型转换,包括Collection、Map、强转、Array等
final T result = convertSpecial(type, rowType, value, defaultValue);
if(null != result) {
return result;
}

// 标准转换器
final Converter<T> converter = getConverter(type, isCustomFirst);
if (null != converter) {
Expand All @@ -208,7 +216,8 @@ public <T> T convert(Type type, Object value, T defaultValue, boolean isCustomFi
if (BeanUtil.isBean(rowType)) {
return new BeanConverter<T>(rowType).convert(value, defaultValue);
}



// 无法转换
throw new ConvertException("No Converter for type [{}]", rowType.getName());
}
Expand Down Expand Up @@ -263,6 +272,7 @@ private <T> T convertSpecial(Type type, Class<T> rowType, Object value, T defaul
if(null == rowType) {
return null;
}


// 集合转换(不可以默认强转)
if (Collection.class.isAssignableFrom(rowType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
* @since 3.0.8
*/
public class MapConverter extends AbstractConverter<Map<?, ?>> {

/** Map类型 */
private final Type mapType;
/** 键类型 */
private final Type keyType;
/** 值类型 */
private final Type valueType;

/**
* 构造,Map的key和value泛型类型自动获取
*
Expand All @@ -34,9 +34,10 @@ public class MapConverter extends AbstractConverter<Map<?, ?>> {
public MapConverter(Type mapType) {
this(mapType, TypeUtil.getTypeArgument(mapType, 0), TypeUtil.getTypeArgument(mapType, 1));
}

/**
* 构造
*
* @param mapType Map类型
* @param keyType 键类型
* @param valueType 值类型
Expand All @@ -46,38 +47,47 @@ public MapConverter(Type mapType, Type keyType, Type valueType) {
this.keyType = keyType;
this.valueType = valueType;
}

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Map<?, ?> convertInternal(Object value) {
Map map = null;
if(value instanceof Map){
if (value instanceof Map) {
final Type[] typeArguments = TypeUtil.getTypeArguments(value.getClass());
if (null != typeArguments //
&& 2 == typeArguments.length//
&& this.keyType.equals(typeArguments[0]) //
&& this.valueType.equals(typeArguments[1])) {
//对于键值对类型一致的Map对象,不再做转换,直接返回原对象
return (Map) value;
}
map = MapUtil.createMap(TypeUtil.getClass(this.mapType));
convertMapToMap((Map)value, map);
}else if(BeanUtil.isBean(value.getClass())){
convertMapToMap((Map) value, map);
} else if (BeanUtil.isBean(value.getClass())) {
map = BeanUtil.beanToMap(value);
}else{
} else {
throw new UnsupportedOperationException(StrUtil.format("Unsupport toMap value type: {}", value.getClass().getName()));
}
return map;
}

/**
* Map转Map
*
* @param srcMap 源Map
* @param targetMap 目标Map
*/
private void convertMapToMap(Map<?, ?> srcMap, Map<Object, Object> targetMap){
private void convertMapToMap(Map<?, ?> srcMap, Map<Object, Object> targetMap) {
final ConverterRegistry convert = ConverterRegistry.getInstance();
Object key;
Object value;
for (Entry<?, ?> entry : srcMap.entrySet()) {
key = (null == this.keyType) ? entry.getKey() : convert.convert(this.keyType, entry.getKey());
value = (null == this.valueType) ? entry.getValue() : convert.convert(this.keyType, entry.getValue());
value = (null == this.valueType) ? entry.getValue() : convert.convert(this.valueType, entry.getValue());
targetMap.put(key, value);
}
}

@Override
@SuppressWarnings("unchecked")
public Class<Map<?, ?>> getTargetType() {
Expand Down
Loading

0 comments on commit a9889cc

Please sign in to comment.