Commit e5bd5178294edbdd0eecbded333397f199196de9
1 parent
e1b8ae09
perf: final方法改为大写命名
Showing
5 changed files
with
19 additions
and
19 deletions
yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtils.java
| ... | ... | @@ -27,7 +27,7 @@ public class DictFrameworkUtils { |
| 27 | 27 | /** |
| 28 | 28 | * 针对 {@link #getDictDataLabel(String, String)} 的缓存 |
| 29 | 29 | */ |
| 30 | - private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> getDictDataCache = CacheUtils.buildAsyncReloadingCache( | |
| 30 | + private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> GET_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache( | |
| 31 | 31 | Duration.ofMinutes(1L), // 过期时间 1 分钟 |
| 32 | 32 | new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() { |
| 33 | 33 | |
| ... | ... | @@ -41,7 +41,7 @@ public class DictFrameworkUtils { |
| 41 | 41 | /** |
| 42 | 42 | * 针对 {@link #parseDictDataValue(String, String)} 的缓存 |
| 43 | 43 | */ |
| 44 | - private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> parseDictDataCache = CacheUtils.buildAsyncReloadingCache( | |
| 44 | + private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> PARSE_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache( | |
| 45 | 45 | Duration.ofMinutes(1L), // 过期时间 1 分钟 |
| 46 | 46 | new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() { |
| 47 | 47 | |
| ... | ... | @@ -59,12 +59,12 @@ public class DictFrameworkUtils { |
| 59 | 59 | |
| 60 | 60 | @SneakyThrows |
| 61 | 61 | public static String getDictDataLabel(String dictType, String value) { |
| 62 | - return getDictDataCache.get(new KeyValue<>(dictType, value)).getLabel(); | |
| 62 | + return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, value)).getLabel(); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | @SneakyThrows |
| 66 | 66 | public static String parseDictDataValue(String dictType, String label) { |
| 67 | - return parseDictDataCache.get(new KeyValue<>(dictType, label)).getValue(); | |
| 67 | + return PARSE_DICT_DATA_CACHE.get(new KeyValue<>(dictType, label)).getValue(); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/type/JsonLongSetTypeHandler.java
| ... | ... | @@ -16,11 +16,11 @@ import java.util.Set; |
| 16 | 16 | */ |
| 17 | 17 | public class JsonLongSetTypeHandler extends AbstractJsonTypeHandler<Object> { |
| 18 | 18 | |
| 19 | - private static final TypeReference<Set<Long>> typeReference = new TypeReference<Set<Long>>(){}; | |
| 19 | + private static final TypeReference<Set<Long>> TYPE_REFERENCE = new TypeReference<Set<Long>>(){}; | |
| 20 | 20 | |
| 21 | 21 | @Override |
| 22 | 22 | protected Object parse(String json) { |
| 23 | - return JsonUtils.parseObject(json, typeReference); | |
| 23 | + return JsonUtils.parseObject(json, TYPE_REFERENCE); | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | @Override | ... | ... |
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/RedisKeyRegistry.java
| ... | ... | @@ -11,18 +11,18 @@ public class RedisKeyRegistry { |
| 11 | 11 | /** |
| 12 | 12 | * Redis RedisKeyDefine 数组 |
| 13 | 13 | */ |
| 14 | - private static final List<RedisKeyDefine> defines = new ArrayList<>(); | |
| 14 | + private static final List<RedisKeyDefine> DEFINES = new ArrayList<>(); | |
| 15 | 15 | |
| 16 | 16 | public static void add(RedisKeyDefine define) { |
| 17 | - defines.add(define); | |
| 17 | + DEFINES.add(define); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public static List<RedisKeyDefine> list() { |
| 21 | - return defines; | |
| 21 | + return DEFINES; | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public static int size() { |
| 25 | - return defines.size(); | |
| 25 | + return DEFINES.size(); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java
| ... | ... | @@ -17,19 +17,19 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se |
| 17 | 17 | /** |
| 18 | 18 | * 使用 TransmittableThreadLocal 作为上下文 |
| 19 | 19 | */ |
| 20 | - private static final ThreadLocal<SecurityContext> contextHolder = new TransmittableThreadLocal<>(); | |
| 20 | + private static final ThreadLocal<SecurityContext> CONTEXT_HOLDER = new TransmittableThreadLocal<>(); | |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public void clearContext() { |
| 24 | - contextHolder.remove(); | |
| 24 | + CONTEXT_HOLDER.remove(); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | @Override |
| 28 | 28 | public SecurityContext getContext() { |
| 29 | - SecurityContext ctx = contextHolder.get(); | |
| 29 | + SecurityContext ctx = CONTEXT_HOLDER.get(); | |
| 30 | 30 | if (ctx == null) { |
| 31 | 31 | ctx = createEmptyContext(); |
| 32 | - contextHolder.set(ctx); | |
| 32 | + CONTEXT_HOLDER.set(ctx); | |
| 33 | 33 | } |
| 34 | 34 | return ctx; |
| 35 | 35 | } |
| ... | ... | @@ -37,7 +37,7 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se |
| 37 | 37 | @Override |
| 38 | 38 | public void setContext(SecurityContext context) { |
| 39 | 39 | Assert.notNull(context, "Only non-null SecurityContext instances are permitted"); |
| 40 | - contextHolder.set(context); | |
| 40 | + CONTEXT_HOLDER.set(context); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | @Override | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
| ... | ... | @@ -31,7 +31,7 @@ public class CodegenBuilder { |
| 31 | 31 | * 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射 |
| 32 | 32 | * 注意,字段的匹配以后缀的方式 |
| 33 | 33 | */ |
| 34 | - private static final Map<String, CodegenColumnListConditionEnum> columnListOperationConditionMappings = | |
| 34 | + private static final Map<String, CodegenColumnListConditionEnum> COLUMN_LIST_OPERATION_CONDITION_MAPPINGS = | |
| 35 | 35 | MapUtil.<String, CodegenColumnListConditionEnum>builder() |
| 36 | 36 | .put("name", CodegenColumnListConditionEnum.LIKE) |
| 37 | 37 | .put("time", CodegenColumnListConditionEnum.BETWEEN) |
| ... | ... | @@ -42,7 +42,7 @@ public class CodegenBuilder { |
| 42 | 42 | * 字段名与 {@link CodegenColumnHtmlTypeEnum} 的默认映射 |
| 43 | 43 | * 注意,字段的匹配以后缀的方式 |
| 44 | 44 | */ |
| 45 | - private static final Map<String, CodegenColumnHtmlTypeEnum> columnHtmlTypeMappings = | |
| 45 | + private static final Map<String, CodegenColumnHtmlTypeEnum> COLUMN_HTML_TYPE_MAPPINGS = | |
| 46 | 46 | MapUtil.<String, CodegenColumnHtmlTypeEnum>builder() |
| 47 | 47 | .put("status", CodegenColumnHtmlTypeEnum.RADIO) |
| 48 | 48 | .put("sex", CodegenColumnHtmlTypeEnum.RADIO) |
| ... | ... | @@ -143,7 +143,7 @@ public class CodegenBuilder { |
| 143 | 143 | column.setListOperation(!LIST_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField()) |
| 144 | 144 | && !column.getPrimaryKey()); // 对于主键,列表过滤不需要传递 |
| 145 | 145 | // 处理 listOperationCondition 字段 |
| 146 | - columnListOperationConditionMappings.entrySet().stream() | |
| 146 | + COLUMN_LIST_OPERATION_CONDITION_MAPPINGS.entrySet().stream() | |
| 147 | 147 | .filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey())) |
| 148 | 148 | .findFirst().ifPresent(entry -> column.setListOperationCondition(entry.getValue().getCondition())); |
| 149 | 149 | if (column.getListOperationCondition() == null) { |
| ... | ... | @@ -155,7 +155,7 @@ public class CodegenBuilder { |
| 155 | 155 | |
| 156 | 156 | private void processColumnUI(CodegenColumnDO column) { |
| 157 | 157 | // 基于后缀进行匹配 |
| 158 | - columnHtmlTypeMappings.entrySet().stream() | |
| 158 | + COLUMN_HTML_TYPE_MAPPINGS.entrySet().stream() | |
| 159 | 159 | .filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey())) |
| 160 | 160 | .findFirst().ifPresent(entry -> column.setHtmlType(entry.getValue().getType())); |
| 161 | 161 | // 如果是 Boolean 类型时,设置为 radio 类型. | ... | ... |