From bfcc0a8a97cfcb9d647e3590097cbc6cd87a0e69 Mon Sep 17 00:00:00 2001 From: thinkgem Date: Sun, 13 Mar 2022 19:55:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=20getPropertyToLong=20=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jeesite/common/io/PropertiesUtils.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java b/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java index a9470226..8e375162 100644 --- a/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java +++ b/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java @@ -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