新增属性获取 getPropertyToLong 方法。

This commit is contained in:
thinkgem
2022-03-13 19:55:06 +08:00
parent 18cca069c1
commit 1dec607c8a

View File

@@ -209,7 +209,7 @@ public class PropertiesUtils {
/**
* 获取配置文件中Boolean类型的值取不到从System.getProperty获取取不到返回空。
* @return 获取不到返回空defValue默认值
* @return 获取不到返回空defValue默认值如果结果为非布尔类型则返回false
*/
public Boolean getPropertyToBoolean(String key, String defValue) {
return ObjectUtils.toBoolean(getProperty(key, defValue));
@@ -217,12 +217,20 @@ public class PropertiesUtils {
/**
* 获取配置文件中Integer类型的值取不到从System.getProperty获取取不到返回空。
* @return 获取不到返回空defValue默认值
* @return 获取不到返回空defValue默认值如果结果为非数值类型则返回0
*/
public Integer getPropertyToInteger(String key, String defValue) {
return ObjectUtils.toInteger(getProperty(key, defValue));
}
/**
* 获取配置文件中Long类型的值取不到从System.getProperty获取取不到返回空。
* @return 获取不到返回空defValue默认值如果结果为非数值类型则返回0
*/
public Long getPropertyToLong(String key, String defValue) {
return ObjectUtils.toLong(getProperty(key, defValue));
}
/**
* 设置环境属性
* @param environment