优化PropDesc缓存注解判断,提升性能(pr#1335@Gitee)

This commit is contained in:
Looly 2025-04-26 13:20:40 +08:00
parent 3ff79b3f23
commit 87a6bdeaaa
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -70,7 +70,10 @@ public class PropDesc {
/**
* 在对象的所有属性设置完成后执行初始化逻辑
* <p>
* 预先计算transient关键字和@Transient注解{@link PropIgnore}注解信息
* 预先计算transient关键字和@Transient注解{@link PropIgnore}注解信息<br>
* 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);
}
/**