add method

This commit is contained in:
Looly 2021-07-08 00:38:31 +08:00
parent ead5e1c13a
commit ba9bfee1b6
2 changed files with 43 additions and 24 deletions

View File

@ -3,7 +3,7 @@
-------------------------------------------------------------------------------------------------------------
# 5.7.4 (2021-07-06)
# 5.7.4 (2021-07-08)
### 🐣新特性
* 【crypto 】 SmUtil.sm4统一返回类型issue#I3YKD4@Gitee
@ -12,6 +12,7 @@
* 【core 】 CsvWriter增加writer.write(csvData)的方法重载pr#353@Gitee
* 【core 】 新增AbsCollValueMapissue#I3YXF0@Gitee
* 【crypto 】 HOPT缓存改为8位新增方法pr#356@Gitee
* 【setting】 Props增加toProperties方法issue#1701@Github
### 🐞Bug修复
* 【core 】 修复RadixUtil.decode非static问题issue#I3YPEH@Gitee

View File

@ -61,10 +61,14 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
}
// ----------------------------------------------------------------------- 私有属性 start
/** 属性文件的URL */
/**
* 属性文件的URL
*/
private URL propertiesFileUrl;
private WatchMonitor watchMonitor;
/** properties文件编码 */
/**
* properties文件编码
*/
private Charset charset = CharsetUtil.CHARSET_ISO_8859_1;
// ----------------------------------------------------------------------- 私有属性 end
@ -101,6 +105,7 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
}
// ----------------------------------------------------------------------- 构造方法 start
/**
* 构造
*/
@ -494,6 +499,18 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
return (String) value;
}
/**
* 转换为标准的{@link Properties}对象
*
* @return {@link Properties}对象
* @since 5.7.4
*/
public Properties toProperties() {
final Properties properties = new Properties();
properties.putAll(this);
return properties;
}
/**
* 将配置文件转换为Bean支持嵌套Bean<br>
* 支持的表达式
@ -562,7 +579,7 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
String key;
for (java.util.Map.Entry<Object, Object> entry : this.entrySet()) {
key = (String) entry.getKey();
if(false == StrUtil.startWith(key, prefix)) {
if (false == StrUtil.startWith(key, prefix)) {
// 非指定开头的属性忽略掉
continue;
}
@ -580,6 +597,7 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
// ----------------------------------------------------------------------- Get end
// ----------------------------------------------------------------------- Set start
/**
* 设置值无给定键创建之设置后未持久化
*