From 87a6bdeaaa8e60c5379c16a65a1dd9a6b74c6047 Mon Sep 17 00:00:00 2001 From: Looly Date: Sat, 26 Apr 2025 13:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96`PropDesc`=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E5=88=A4=E6=96=AD=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E6=80=A7=E8=83=BD=EF=BC=88pr#1335@Gitee=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../src/main/java/cn/hutool/core/bean/PropDesc.java | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1ed66331..53bf50c3f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * 【core 】 重载subtractToList方法,提供isLinked选项(pr#3923@Github) * 【extra 】 `TemplateConfig`增加`setUseCache`方法(issue#IC3JRY@Gitee) * 【extra 】 `AbstractFtp`增加`rename`方法(issue#IC3PMI@Gitee) +* 【core 】 优化`PropDesc`缓存注解判断,提升性能(pr#1335@Gitee) ### 🐞Bug修复 * 【setting】 修复`Setting`autoLoad可能的加载为空的问题(issue#3919@Github) diff --git a/hutool-core/src/main/java/cn/hutool/core/bean/PropDesc.java b/hutool-core/src/main/java/cn/hutool/core/bean/PropDesc.java index 65e5560c3..eba279382 100644 --- a/hutool-core/src/main/java/cn/hutool/core/bean/PropDesc.java +++ b/hutool-core/src/main/java/cn/hutool/core/bean/PropDesc.java @@ -70,7 +70,10 @@ public class PropDesc { /** * 在对象的所有属性设置完成后,执行初始化逻辑。 *

- * 预先计算transient关键字和@Transient注解、{@link PropIgnore}注解信息 + * 预先计算transient关键字和@Transient注解、{@link PropIgnore}注解信息
+ * 见:https://gitee.com/chinabugotech/hutool/pulls/1335 + * + * @since 5.8.38 */ public void initialize() { transientForGet = isTransientForGet(); @@ -78,6 +81,7 @@ public class PropDesc { ignoreGet = isIgnoreGet(); ignoreSet = isIgnoreSet(); } + /** * 获取字段名,如果存在Alias注解,读取注解的值作为名称 * @@ -370,7 +374,7 @@ public class PropDesc { */ private boolean isIgnoreSet() { return AnnotationUtil.hasAnnotation(this.field, PropIgnore.class) - || AnnotationUtil.hasAnnotation(this.setter, PropIgnore.class); + || AnnotationUtil.hasAnnotation(this.setter, PropIgnore.class); } /** @@ -385,7 +389,7 @@ public class PropDesc { */ private boolean isIgnoreGet() { return AnnotationUtil.hasAnnotation(this.field, PropIgnore.class) - || AnnotationUtil.hasAnnotation(this.getter, PropIgnore.class); + || AnnotationUtil.hasAnnotation(this.getter, PropIgnore.class); } /**