diff --git a/today-context/src/main/java/cn/taketoday/cache/annotation/AnnotationCacheOperationSource.java b/today-context/src/main/java/cn/taketoday/cache/annotation/AnnotationCacheOperationSource.java index 070169f002..ab39d5bfab 100644 --- a/today-context/src/main/java/cn/taketoday/cache/annotation/AnnotationCacheOperationSource.java +++ b/today-context/src/main/java/cn/taketoday/cache/annotation/AnnotationCacheOperationSource.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.annotation; @@ -47,6 +44,7 @@ * @author Costin Leau * @author Juergen Hoeller * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") diff --git a/today-context/src/main/java/cn/taketoday/cache/annotation/CachingConfigurationSelector.java b/today-context/src/main/java/cn/taketoday/cache/annotation/CachingConfigurationSelector.java index 137faa41ea..27f28a9e9e 100644 --- a/today-context/src/main/java/cn/taketoday/cache/annotation/CachingConfigurationSelector.java +++ b/today-context/src/main/java/cn/taketoday/cache/annotation/CachingConfigurationSelector.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.annotation; @@ -38,6 +35,7 @@ * * @author Chris Beams * @author Stephane Nicoll + * @author Harry Yang * @see EnableCaching * @see ProxyCachingConfiguration * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/cache/annotation/DefaultCacheAnnotationParser.java b/today-context/src/main/java/cn/taketoday/cache/annotation/DefaultCacheAnnotationParser.java index 178bf066a9..0f8d946d43 100644 --- a/today-context/src/main/java/cn/taketoday/cache/annotation/DefaultCacheAnnotationParser.java +++ b/today-context/src/main/java/cn/taketoday/cache/annotation/DefaultCacheAnnotationParser.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.annotation; @@ -47,6 +44,7 @@ * @author Phillip Webb * @author Stephane Nicoll * @author Sam Brannen + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") @@ -94,7 +92,7 @@ private Collection parseCacheAnnotations( Collection anns = localOnly ? AnnotatedElementUtils.getAllMergedAnnotations(ae, CACHE_OPERATION_ANNOTATIONS) - : AnnotatedElementUtils.findAllMergedAnnotations(ae, CACHE_OPERATION_ANNOTATIONS); + : AnnotatedElementUtils.findAllMergedAnnotations(ae, CACHE_OPERATION_ANNOTATIONS); if (anns.isEmpty()) { return null; } @@ -209,13 +207,13 @@ private void parseCachingAnnotation( private void validateCacheOperation(AnnotatedElement ae, CacheOperation operation) { if (StringUtils.hasText(operation.getKey()) && StringUtils.hasText(operation.getKeyGenerator())) { throw new IllegalStateException("Invalid cache annotation configuration on '" + - ae.toString() + "'. Both 'key' and 'keyGenerator' attributes have been set. " + + ae + "'. Both 'key' and 'keyGenerator' attributes have been set. " + "These attributes are mutually exclusive: either set the EL expression used to" + "compute the key at runtime or set the name of the KeyGenerator bean to use."); } if (StringUtils.hasText(operation.getCacheManager()) && StringUtils.hasText(operation.getCacheResolver())) { throw new IllegalStateException("Invalid cache annotation configuration on '" + - ae.toString() + "'. Both 'cacheManager' and 'cacheResolver' attributes have been set. " + + ae + "'. Both 'cacheManager' and 'cacheResolver' attributes have been set. " + "These attributes are mutually exclusive: the cache manager is used to configure a" + "default cache resolver if none is set. If a cache resolver is set, the cache manager" + "won't be used."); diff --git a/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCache.java b/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCache.java index 9da8cbe67f..83a4d165a3 100644 --- a/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCache.java +++ b/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.concurrent; @@ -220,8 +220,8 @@ protected Object toStoreValue(@Nullable Object userValue) { return this.serialization.serializeToByteArray(storeValue); } catch (Throwable ex) { - throw new IllegalArgumentException("Failed to serialize cache value '" + userValue + - "'. Does it implement Serializable?", ex); + throw new IllegalArgumentException("Failed to serialize cache value '%s'. Does it implement Serializable?" + .formatted(userValue), ex); } } else { @@ -236,7 +236,7 @@ protected Object fromStoreValue(@Nullable Object storeValue) { return super.fromStoreValue(this.serialization.deserializeFromByteArray((byte[]) storeValue)); } catch (Throwable ex) { - throw new IllegalArgumentException("Failed to deserialize cache value '" + storeValue + "'", ex); + throw new IllegalArgumentException("Failed to deserialize cache value '%s'".formatted(storeValue), ex); } } else { diff --git a/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCacheFactoryBean.java b/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCacheFactoryBean.java index 92e600a895..e26389fbf3 100644 --- a/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCacheFactoryBean.java +++ b/today-context/src/main/java/cn/taketoday/cache/concurrent/ConcurrentMapCacheFactoryBean.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.concurrent; @@ -40,6 +37,7 @@ * * @author Costin Leau * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public class ConcurrentMapCacheFactoryBean @@ -91,7 +89,7 @@ public void setBeanName(String beanName) { @Override public void afterPropertiesSet() { this.cache = (this.store != null ? new ConcurrentMapCache(this.name, this.store, this.allowNullValues) : - new ConcurrentMapCache(this.name, this.allowNullValues)); + new ConcurrentMapCache(this.name, this.allowNullValues)); } @Override diff --git a/today-context/src/main/java/cn/taketoday/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java b/today-context/src/main/java/cn/taketoday/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java index 4f8521d7c6..47d15407a4 100644 --- a/today-context/src/main/java/cn/taketoday/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java +++ b/today-context/src/main/java/cn/taketoday/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.config; @@ -55,6 +52,7 @@ * * @author Costin Leau * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser { diff --git a/today-context/src/main/java/cn/taketoday/cache/config/CacheAdviceParser.java b/today-context/src/main/java/cn/taketoday/cache/config/CacheAdviceParser.java index 21f52efaf4..3142a4e4ec 100644 --- a/today-context/src/main/java/cn/taketoday/cache/config/CacheAdviceParser.java +++ b/today-context/src/main/java/cn/taketoday/cache/config/CacheAdviceParser.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.config; @@ -51,6 +48,7 @@ * @author Costin Leau * @author Phillip Webb * @author Stephane Nicoll + * @author Harry Yang */ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser { diff --git a/today-context/src/main/java/cn/taketoday/cache/config/CacheManagementConfigUtils.java b/today-context/src/main/java/cn/taketoday/cache/config/CacheManagementConfigUtils.java index 7154f9d768..88e0cf6f1f 100644 --- a/today-context/src/main/java/cn/taketoday/cache/config/CacheManagementConfigUtils.java +++ b/today-context/src/main/java/cn/taketoday/cache/config/CacheManagementConfigUtils.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.config; @@ -24,6 +21,7 @@ * Configuration constants for internal sharing across subpackages. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public abstract class CacheManagementConfigUtils { diff --git a/today-context/src/main/java/cn/taketoday/cache/config/CacheNamespaceHandler.java b/today-context/src/main/java/cn/taketoday/cache/config/CacheNamespaceHandler.java index c9cb9a087d..231a0faf53 100644 --- a/today-context/src/main/java/cn/taketoday/cache/config/CacheNamespaceHandler.java +++ b/today-context/src/main/java/cn/taketoday/cache/config/CacheNamespaceHandler.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.config; @@ -35,6 +32,7 @@ * Framework cache management facilities. * * @author Costin Leau + * @author Harry Yang * @since 4.0 */ public class CacheNamespaceHandler extends NamespaceHandlerSupport { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheInvoker.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheInvoker.java index 4518e4f775..7203b0e7a9 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheInvoker.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheInvoker.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -30,6 +27,7 @@ * * @author Stephane Nicoll * @author Juergen Hoeller + * @author Harry Yang * @see CacheErrorHandler * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheResolver.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheResolver.java index e86c718eac..0b13997de9 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheResolver.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractCacheResolver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -37,6 +34,7 @@ * * @author Stephane Nicoll * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public abstract class AbstractCacheResolver implements CacheResolver, InitializingBean { @@ -92,8 +90,7 @@ public Collection resolveCaches(CacheOperationInvocationContext for (String cacheName : cacheNames) { Cache cache = cacheManager.getCache(cacheName); if (cache == null) { - throw new IllegalArgumentException("Cannot find cache named '" + - cacheName + "' for " + context.getOperation()); + throw new IllegalArgumentException("Cannot find cache named '%s' for %s".formatted(cacheName, context.getOperation())); } result.add(cache); } diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractFallbackCacheOperationSource.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractFallbackCacheOperationSource.java index 6e304dfe96..22dcfb7582 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractFallbackCacheOperationSource.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/AbstractFallbackCacheOperationSource.java @@ -97,9 +97,7 @@ public Collection getCacheOperations(Method method, @Nullable Cl * is not cacheable */ @Nullable - private Collection getCacheOperations( - Method method, @Nullable Class targetClass, boolean cacheNull) { - + private Collection getCacheOperations(Method method, @Nullable Class targetClass, boolean cacheNull) { if (ReflectionUtils.isObjectMethod(method)) { return null; } diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java index ff9ac05197..d5ed8f5cae 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -31,6 +28,7 @@ * cache advice bean for methods that are cacheable. * * @author Costin Leau + * @author Harry Yang * @since 4.0 */ public class BeanFactoryCacheOperationSourceAdvisor extends AbstractBeanFactoryPointcutAdvisor { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheAspectSupport.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheAspectSupport.java index 7fc46da7f7..82b26a4dda 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheAspectSupport.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheAspectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -164,8 +164,8 @@ public void configure(@Nullable Supplier errorHandler, @Nulla public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) { Assert.notEmpty(cacheOperationSources, "At least 1 CacheOperationSource needs to be specified"); this.cacheOperationSource = cacheOperationSources.length > 1 ? - new CompositeCacheOperationSource(cacheOperationSources) : - cacheOperationSources[0]; + new CompositeCacheOperationSource(cacheOperationSources) : + cacheOperationSources[0]; } /** @@ -286,9 +286,9 @@ protected String methodIdentification(Method method, Class targetClass) { protected Collection getCaches(CacheOperationInvocationContext context, CacheResolver cacheResolver) { Collection caches = cacheResolver.resolveCaches(context); if (caches.isEmpty()) { - throw new IllegalStateException("No cache could be resolved for '" + - context.getOperation() + "' using resolver '" + cacheResolver + - "'. At least one cache should be provided per cache operation."); + throw new IllegalStateException( + "No cache could be resolved for '%s' using resolver '%s'. At least one cache should be provided per cache operation." + .formatted(context.getOperation(), cacheResolver)); } return caches; } @@ -356,7 +356,7 @@ else if (StringUtils.hasText(operation.getCacheManager())) { protected T getBean(String name, Class serviceType) { if (this.beanFactory == null) { throw new IllegalStateException( - "BeanFactory must be set on cache aspect for " + serviceType.getSimpleName() + " retrieval"); + "BeanFactory must be set on cache aspect for %s retrieval".formatted(serviceType.getSimpleName())); } return BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.beanFactory, serviceType, name); } @@ -787,8 +787,8 @@ public CacheOperationMetadata(CacheOperation operation, Method method, this.targetClass = targetClass; this.method = BridgeMethodResolver.findBridgedMethod(method); this.targetMethod = !Proxy.isProxyClass(targetClass) - ? AopUtils.getMostSpecificMethod(method, targetClass) - : this.method; + ? AopUtils.getMostSpecificMethod(method, targetClass) + : this.method; this.methodKey = new AnnotatedElementKey(this.targetMethod, targetClass); this.keyGenerator = keyGenerator; this.cacheResolver = cacheResolver; diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheEvictOperation.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheEvictOperation.java index 76fa6e14eb..a8ab167abc 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheEvictOperation.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheEvictOperation.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -25,6 +22,7 @@ * * @author Costin Leau * @author Marcin Kamionowski + * @author Harry Yang * @since 4.0 */ public class CacheEvictOperation extends CacheOperation { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheInterceptor.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheInterceptor.java index 379191ce4e..6043a87c34 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheInterceptor.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheInterceptor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -44,6 +41,7 @@ * * @author Costin Leau * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperation.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperation.java index d5728065ce..c7eb09c34f 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperation.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperation.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -34,6 +31,7 @@ * @author Costin Leau * @author Stephane Nicoll * @author Marcin Kamionowski + * @author Harry Yang * @since 4.0 */ public abstract class CacheOperation implements BasicOperation { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperationInvocationContext.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperationInvocationContext.java index cc2113c04f..0d0a001289 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperationInvocationContext.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheOperationInvocationContext.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -30,6 +27,7 @@ * * @param the operation type * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ public interface CacheOperationInvocationContext { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CachePutOperation.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CachePutOperation.java index 8fb0fd37d7..cbe64f8324 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CachePutOperation.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CachePutOperation.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -28,6 +25,7 @@ * @author Costin Leau * @author Phillip Webb * @author Marcin Kamionowski + * @author Harry Yang * @since 4.0 */ public class CachePutOperation extends CacheOperation { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheableOperation.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheableOperation.java index 80f8cb0842..1f77b51ac0 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheableOperation.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/CacheableOperation.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -28,6 +25,7 @@ * @author Costin Leau * @author Phillip Webb * @author Marcin Kamionowski + * @author Harry Yang * @since 4.0 */ public class CacheableOperation extends CacheOperation { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/KeyGenerator.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/KeyGenerator.java index 771b05cfa6..be58e845e6 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/KeyGenerator.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/KeyGenerator.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -29,6 +26,7 @@ * @author Costin Leau * @author Chris Beams * @author Phillip Webb + * @author Harry Yang * @since 4.0 */ @FunctionalInterface diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/LoggingCacheErrorHandler.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/LoggingCacheErrorHandler.java index e1f3e870ae..dc24c5ef61 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/LoggingCacheErrorHandler.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/LoggingCacheErrorHandler.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -32,6 +29,7 @@ * * @author Adam Ostrožlík * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ public class LoggingCacheErrorHandler implements CacheErrorHandler { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/NameMatchCacheOperationSource.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/NameMatchCacheOperationSource.java index 8a673587de..45f49278aa 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/NameMatchCacheOperationSource.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/NameMatchCacheOperationSource.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -37,6 +34,7 @@ * by registered name. * * @author Costin Leau + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/NamedCacheResolver.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/NamedCacheResolver.java index aac305cfd5..f4542e8974 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/NamedCacheResolver.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/NamedCacheResolver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -31,6 +28,7 @@ * collection of name(s) against a given {@link CacheManager}. * * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ public class NamedCacheResolver extends AbstractCacheResolver { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheErrorHandler.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheErrorHandler.java index 6230e45975..7b0ae5c6fc 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheErrorHandler.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheErrorHandler.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -28,6 +25,7 @@ * exception at all, simply throwing it back at the client. * * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ public class SimpleCacheErrorHandler implements CacheErrorHandler { diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheResolver.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheResolver.java index bb5907cacd..6370233bfa 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheResolver.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleCacheResolver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -33,6 +30,7 @@ * * @author Stephane Nicoll * @author Juergen Hoeller + * @author Harry Yang * @see BasicOperation#getCacheNames() * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKey.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKey.java index 08bd077783..77a0770914 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKey.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKey.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -35,6 +32,7 @@ * * @author Phillip Webb * @author Juergen Hoeller + * @author Harry Yang * @see SimpleKeyGenerator * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKeyGenerator.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKeyGenerator.java index bae74353c4..7e1fc78a9d 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKeyGenerator.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/SimpleKeyGenerator.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.interceptor; @@ -38,6 +35,7 @@ * * @author Phillip Webb * @author Juergen Hoeller + * @author Harry Yang * @see SimpleKey * @see CachingConfigurer * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/cache/interceptor/VariableNotAvailableException.java b/today-context/src/main/java/cn/taketoday/cache/interceptor/VariableNotAvailableException.java index cd813dc1db..2fcd1f0fb6 100644 --- a/today-context/src/main/java/cn/taketoday/cache/interceptor/VariableNotAvailableException.java +++ b/today-context/src/main/java/cn/taketoday/cache/interceptor/VariableNotAvailableException.java @@ -32,7 +32,7 @@ class VariableNotAvailableException extends ExpressionException { public VariableNotAvailableException(String name) { - super("Variable '" + name + "' not available"); + super("Variable '%s' not available".formatted(name)); } } diff --git a/today-context/src/main/java/cn/taketoday/cache/support/AbstractCacheManager.java b/today-context/src/main/java/cn/taketoday/cache/support/AbstractCacheManager.java index 672fc5bf2b..3725aae644 100644 --- a/today-context/src/main/java/cn/taketoday/cache/support/AbstractCacheManager.java +++ b/today-context/src/main/java/cn/taketoday/cache/support/AbstractCacheManager.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.support; @@ -38,7 +35,7 @@ * @author Costin Leau * @author Juergen Hoeller * @author Stephane Nicoll - * @author TODAY + * @author Harry Yang * @since 2020-08-15 19:18 */ public abstract class AbstractCacheManager implements CacheManager, InitializingBean { diff --git a/today-context/src/main/java/cn/taketoday/cache/support/AbstractValueAdaptingCache.java b/today-context/src/main/java/cn/taketoday/cache/support/AbstractValueAdaptingCache.java index 67c794fd2c..0a62dec4c3 100644 --- a/today-context/src/main/java/cn/taketoday/cache/support/AbstractValueAdaptingCache.java +++ b/today-context/src/main/java/cn/taketoday/cache/support/AbstractValueAdaptingCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.support; @@ -67,7 +67,7 @@ public T get(Object key, @Nullable Class type) { Object value = fromStoreValue(lookup(key)); if (value != null && type != null && !type.isInstance(value)) { throw new IllegalStateException( - "Cached value is not of required type [" + type.getName() + "]: " + value); + "Cached value is not of required type [%s]: %s".formatted(type.getName(), value)); } return (T) value; } @@ -109,7 +109,7 @@ protected Object toStoreValue(@Nullable Object userValue) { return NullValue.INSTANCE; } throw new IllegalArgumentException( - "Cache '" + getName() + "' is configured to not allow null values but null was provided"); + "Cache '%s' is configured to not allow null values but null was provided".formatted(getName())); } return userValue; } diff --git a/today-context/src/main/java/cn/taketoday/cache/support/DefaultCacheKey.java b/today-context/src/main/java/cn/taketoday/cache/support/DefaultCacheKey.java deleted file mode 100644 index 79b126975c..0000000000 --- a/today-context/src/main/java/cn/taketoday/cache/support/DefaultCacheKey.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.cache.support; - -import java.io.Serial; -import java.io.Serializable; -import java.util.Arrays; - -import cn.taketoday.lang.NullValue; - -/** - * @author TODAY
- * 2019-02-27 18:12 - */ -public class DefaultCacheKey implements Serializable { - @Serial - private static final long serialVersionUID = 1L; - - public static final DefaultCacheKey EMPTY = new DefaultCacheKey(new Object[] { NullValue.INSTANCE }); - - private final int hash; - private final Object[] params; - - /** - * Create a new {@link DefaultCacheKey} instance. - * - * @param params the method parameters - */ - public DefaultCacheKey(Object[] params) { - if (params == null) { - this.params = EMPTY.getParams(); - } - else { - this.params = new Object[params.length]; - System.arraycopy(params, 0, this.params, 0, params.length); - } - this.hash = Arrays.hashCode(this.params); - } - - @Override - public boolean equals(Object other) { - return (this == other // - || (other instanceof DefaultCacheKey - && Arrays.deepEquals(getParams(), ((DefaultCacheKey) other).getParams()))// - ); - } - - @Override - public int hashCode() { - return this.hash; - } - - @Override - public String toString() { - return getClass().getSimpleName() + " " + Arrays.toString(getParams()); - } - - public Object[] getParams() { - return params; - } -} diff --git a/today-context/src/main/java/cn/taketoday/cache/support/SimpleValueWrapper.java b/today-context/src/main/java/cn/taketoday/cache/support/SimpleValueWrapper.java index bed015e7bf..1d58af8b14 100644 --- a/today-context/src/main/java/cn/taketoday/cache/support/SimpleValueWrapper.java +++ b/today-context/src/main/java/cn/taketoday/cache/support/SimpleValueWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.cache.support; @@ -65,7 +65,7 @@ public int hashCode() { @Override public String toString() { - return "ValueWrapper for [" + this.value + "]"; + return "ValueWrapper for [%s]".formatted(this.value); } } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/AnnotationBeanNameGenerator.java b/today-context/src/main/java/cn/taketoday/context/annotation/AnnotationBeanNameGenerator.java index 84382a79a1..4e9c33d0ee 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/AnnotationBeanNameGenerator.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/AnnotationBeanNameGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -148,8 +148,8 @@ protected String determineBeanNameFromAnnotation(AnnotatedBeanDefinition annotat } if (beanName != null && !currentName.equals(beanName)) { - throw new IllegalStateException("Stereotype annotations suggest inconsistent " + - "component names: '" + beanName + "' versus '" + currentName + "'"); + throw new IllegalStateException("Stereotype annotations suggest inconsistent component names: '%s' versus '%s'" + .formatted(beanName, currentName)); } annotatedDef.setAttribute(BeanNameHolder.AttributeName, beanNameHolder); beanName = currentName; diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/BeanAnnotationHelper.java b/today-context/src/main/java/cn/taketoday/context/annotation/BeanAnnotationHelper.java index 1be73e5093..33445c66fc 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/BeanAnnotationHelper.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/BeanAnnotationHelper.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -32,6 +29,7 @@ * * @author Chris Beams * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ abstract class BeanAnnotationHelper { diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathBeanDefinitionScanner.java b/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathBeanDefinitionScanner.java index cd2ed28c5f..d392de9f2e 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathBeanDefinitionScanner.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathBeanDefinitionScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -405,9 +405,9 @@ protected boolean checkCandidate(String beanName, BeanDefinition beanDefinition) if (isCompatible(beanDefinition, existingDef)) { return false; } - throw new ConflictingBeanDefinitionException("Annotation-specified bean name '" + beanName + - "' for bean class [" + beanDefinition.getBeanClassName() + "] conflicts with existing, " + - "non-compatible bean definition of same name and class [" + existingDef.getBeanClassName() + "]"); + throw new ConflictingBeanDefinitionException( + "Annotation-specified bean name '%s' for bean class [%s] conflicts with existing, non-compatible bean definition of same name and class [%s]" + .formatted(beanName, beanDefinition.getBeanClassName(), existingDef.getBeanClassName())); } /** diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathScanningComponentProvider.java b/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathScanningComponentProvider.java index 9f1b782704..9d9526f8a2 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathScanningComponentProvider.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ClassPathScanningComponentProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -188,9 +188,9 @@ public void scan(String basePackage, MetadataReaderConsumer metadataReaderConsum log.debug("Ignored incompatible class format in {}: {}", resource, ex.getMessage()); } else { - throw new BeanDefinitionStoreException("Incompatible class format in " + resource + - ": set system property 'spring.classformat.ignore' to 'true' " + - "if you mean to ignore such files during classpath scanning", ex); + throw new BeanDefinitionStoreException( + "Incompatible class format in %s: set system property 'infra.classformat.ignore' to 'true' if you mean to ignore such files during classpath scanning" + .formatted(resource), ex); } } }); diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ComponentScanBeanDefinitionParser.java b/today-context/src/main/java/cn/taketoday/context/annotation/ComponentScanBeanDefinitionParser.java index 8127bf13d2..ef7f0e246b 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ComponentScanBeanDefinitionParser.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ComponentScanBeanDefinitionParser.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -245,7 +242,7 @@ protected TypeFilter createTypeFilter(Element element, @Nullable ClassLoader cla Class filterClass = ClassUtils.forName(expression, classLoader); if (!TypeFilter.class.isAssignableFrom(filterClass)) { throw new IllegalArgumentException( - "Class is not assignable to [" + TypeFilter.class.getName() + "]: " + expression); + "Class is not assignable to [%s]: %s".formatted(TypeFilter.class.getName(), expression)); } return (TypeFilter) BeanUtils.newInstance(filterClass); default: @@ -261,12 +258,11 @@ private T instantiateUserDefinedStrategy( result = ReflectionUtils.accessibleConstructor(ClassUtils.forName(className, classLoader)).newInstance(); } catch (ClassNotFoundException ex) { - throw new IllegalArgumentException("Class [" + className + "] for strategy [" + - strategyType.getName() + "] not found", ex); + throw new IllegalArgumentException("Class [%s] for strategy [%s] not found".formatted(className, strategyType.getName()), ex); } catch (Throwable ex) { - throw new IllegalArgumentException("Unable to instantiate class [" + className + "] for strategy [" + - strategyType.getName() + "]: a zero-argument constructor is required", ex); + throw new IllegalArgumentException("Unable to instantiate class [%s] for strategy [%s]: a zero-argument constructor is required" + .formatted(className, strategyType.getName()), ex); } if (!strategyType.isAssignableFrom(result.getClass())) { diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassBeanDefinitionReader.java b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassBeanDefinitionReader.java index 5243b0b8ee..4bd7cea2e9 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassBeanDefinitionReader.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassBeanDefinitionReader.java @@ -194,8 +194,8 @@ private void loadBeanDefinitionsForComponentMethod(ComponentMethod componentMeth if (isOverriddenByExistingDefinition(componentMethod, beanName)) { if (beanName.equals(componentMethod.configurationClass.beanName)) { throw new BeanDefinitionStoreException(componentMethod.configurationClass.resource.toString(), - beanName, "Bean name derived from @Component method '" + componentMethod.metadata.getMethodName() + - "' clashes with bean name for containing configuration class; please make those names unique!"); + beanName, ("Bean name derived from @Component method '%s' clashes with bean name for containing configuration class; " + + "please make those names unique!").formatted(componentMethod.metadata.getMethodName())); } return; } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassParser.java b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassParser.java index abe42568e5..cf0dcf05f2 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassParser.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassParser.java @@ -157,7 +157,7 @@ else if (bd instanceof AbstractBeanDefinition && ((AbstractBeanDefinition) bd).h } catch (Throwable ex) { throw new BeanDefinitionStoreException( - "Failed to parse configuration class [" + bd.getBeanClassName() + "]", ex); + "Failed to parse configuration class [%s]".formatted(bd.getBeanClassName()), ex); } } @@ -238,7 +238,7 @@ else if (configClass.scanned) { } catch (IOException ex) { throw new BeanDefinitionStoreException( - "I/O failure while processing configuration class [" + sourceClass + "]", ex); + "I/O failure while processing configuration class [%s]".formatted(sourceClass), ex); } configurationClasses.put(configClass, configClass); @@ -572,9 +572,8 @@ else if (candidate.isAssignable(ImportBeanDefinitionRegistrar.class)) { throw ex; } catch (Throwable ex) { - throw new BeanDefinitionStoreException( - "Failed to process import candidates for configuration class [" + - configClass.metadata.getClassName() + "]: " + ex.getMessage(), ex); + throw new BeanDefinitionStoreException("Failed to process import candidates for configuration class [%s]: %s" + .formatted(configClass.metadata.getClassName(), ex.getMessage()), ex); } finally { importRegistry.pop(); @@ -652,7 +651,7 @@ SourceClass asSourceClass(@Nullable String className, Predicate filter) return new SourceClass(ClassUtils.forName(className, bootstrapContext.getClassLoader())); } catch (ClassNotFoundException ex) { - throw new IOException("Failed to load class [" + className + "]", ex); + throw new IOException("Failed to load class [%s]".formatted(className), ex); } } return new SourceClass(bootstrapContext.getMetadataReader(className)); @@ -758,9 +757,8 @@ public void processGroupImports() { throw ex; } catch (Throwable ex) { - throw new BeanDefinitionStoreException( - "Failed to process import candidates for configuration class [" + - configurationClass.metadata.getClassName() + "]", ex); + throw new BeanDefinitionStoreException("Failed to process import candidates for configuration class [%s]" + .formatted(configurationClass.metadata.getClassName()), ex); } } } @@ -1000,7 +998,7 @@ private SourceClass getRelated(String className) throws IOException { catch (ClassNotFoundException ex) { // Ignore -> fall back to ASM next, except for core java types. if (className.startsWith("java")) { - throw new IOException("Failed to load class [" + className + "]", ex); + throw new IOException("Failed to load class [%s]".formatted(className), ex); } return new SourceClass(bootstrapContext.getMetadataReader(className)); } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassPostProcessor.java b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassPostProcessor.java index f13bc77be0..43c43d8068 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassPostProcessor.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ConfigurationClassPostProcessor.java @@ -431,8 +431,9 @@ public void enhanceConfigurationClasses(ConfigurableBeanFactory beanFactory) { } if (ConfigurationClassUtils.CONFIGURATION_CLASS_FULL.equals(configClassAttr)) { if (!(beanDef instanceof AbstractBeanDefinition abd)) { - throw new BeanDefinitionStoreException("Cannot enhance @Configuration bean definition '" + - beanName + "' since it is not stored in an AbstractBeanDefinition subclass"); + throw new BeanDefinitionStoreException( + "Cannot enhance @Configuration bean definition '%s' since it is not stored in an AbstractBeanDefinition subclass" + .formatted(beanName)); } else if (beanFactory.containsSingleton(beanName)) { if (log.isWarnEnabled()) { diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ConflictingBeanDefinitionException.java b/today-context/src/main/java/cn/taketoday/context/annotation/ConflictingBeanDefinitionException.java index 95c3afe00b..51e0f9b0dd 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ConflictingBeanDefinitionException.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ConflictingBeanDefinitionException.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -25,6 +22,7 @@ * catch clauses in calling code. * * @author Chris Beams + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/Jsr330ScopeMetadataResolver.java b/today-context/src/main/java/cn/taketoday/context/annotation/Jsr330ScopeMetadataResolver.java index f85feb4d39..9d2f895acc 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/Jsr330ScopeMetadataResolver.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/Jsr330ScopeMetadataResolver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -97,8 +94,8 @@ public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) { Set metaAnns = annDef.getMetadata().getMetaAnnotationTypes(annType); if (metaAnns.contains("jakarta.inject.Scope")) { if (found != null) { - throw new IllegalStateException("Found ambiguous scope annotations on bean class [" + - definition.getBeanClassName() + "]: " + found + ", " + annType); + throw new IllegalStateException("Found ambiguous scope annotations on bean class [%s]: %s, %s" + .formatted(definition.getBeanClassName(), found, annType)); } found = annType; String scopeName = resolveScopeName(annType); diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/NeverMatchedCondition.java b/today-context/src/main/java/cn/taketoday/context/annotation/NeverMatchedCondition.java deleted file mode 100644 index 1d2ef10735..0000000000 --- a/today-context/src/main/java/cn/taketoday/context/annotation/NeverMatchedCondition.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.taketoday.context.annotation; - -import cn.taketoday.core.type.AnnotatedTypeMetadata; - -/** - * Never match Condition - * - * @author Harry Yang - * @since 4.0 2022/1/13 17:12 - */ -public class NeverMatchedCondition implements Condition { - - @Override - public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - return false; - } - -} diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ScannedGenericBeanDefinition.java b/today-context/src/main/java/cn/taketoday/context/annotation/ScannedGenericBeanDefinition.java index 3e51ba09ea..3c314973db 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ScannedGenericBeanDefinition.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ScannedGenericBeanDefinition.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -47,6 +44,7 @@ * * @author Juergen Hoeller * @author Chris Beams + * @author Harry Yang * @see #getMetadata() * @see #getBeanClassName() * @see MetadataReaderFactory diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/ScopeMetadataResolver.java b/today-context/src/main/java/cn/taketoday/context/annotation/ScopeMetadataResolver.java index 92d5ca5153..72f4997b47 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/ScopeMetadataResolver.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/ScopeMetadataResolver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation; @@ -26,9 +23,9 @@ * Strategy interface for resolving the scope of bean definitions. * * @author Mark Fisher - * @author TODAY 2021/10/26 15:56 + * @author Harry Yang * @see Scope - * @since 4.0 + * @since 4.0 2021/10/26 15:56 */ @FunctionalInterface public interface ScopeMetadataResolver { diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationImportSelector.java b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationImportSelector.java index 8aa82e11f3..0911dc6353 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationImportSelector.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationImportSelector.java @@ -149,8 +149,8 @@ protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) { AnnotationAttributes attributes = AnnotationAttributes.fromMap( metadata.getAnnotationAttributes(name, true)); if (attributes == null) { - throw new IllegalArgumentException("No auto-configuration attributes found. Is " + metadata.getClassName() - + " annotated with " + ClassUtils.getShortName(name) + "?"); + throw new IllegalArgumentException("No auto-configuration attributes found. Is %s annotated with %s?" + .formatted(metadata.getClassName(), ClassUtils.getShortName(name))); } return attributes; } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationMetadata.java b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationMetadata.java index 727eb1c5d0..889627a335 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationMetadata.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation.config; @@ -145,7 +145,7 @@ public static AutoConfigurationMetadata load(@Nullable ClassLoader classLoader, return valueOf(properties); } catch (IOException ex) { - throw new IllegalArgumentException("Unable to load @ConditionalOnClass location [" + path + "]", ex); + throw new IllegalArgumentException("Unable to load @ConditionalOnClass location [%s]".formatted(path), ex); } } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationSorter.java b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationSorter.java index 12a74cedb2..88bde83ac0 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationSorter.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/config/AutoConfigurationSorter.java @@ -107,7 +107,7 @@ private void doSortByAfterAnnotation(AutoConfigurationClasses classes, private void checkForCycles(Set processing, String current, String after) { if (processing.contains(after)) { - throw new IllegalStateException("AutoConfigure cycle detected between " + current + " and " + after); + throw new IllegalStateException("AutoConfigure cycle detected between %s and %s".formatted(current, after)); } } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/config/ImportCandidates.java b/today-context/src/main/java/cn/taketoday/context/annotation/config/ImportCandidates.java index 0f69e9f4f5..cc08618a46 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/config/ImportCandidates.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/config/ImportCandidates.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation.config; @@ -37,7 +34,7 @@ /** * Contains {@code @Configuration} import candidates, usually auto-configurations. - * + *

* The {@link #load(Class, ClassLoader)} method can be used to discover the import * candidates. * @@ -75,7 +72,7 @@ public ArrayList getCandidates() { /** * Loads the names of import candidates from the classpath. - * + *

* The names of the import candidates are stored in files named * {@code META-INF/config/full-qualified-annotation-name.import} on the classpath. * Every line contains the full qualified name of the candidate class. Comments are @@ -111,7 +108,7 @@ private static Enumeration findUrlsInClasspath(ClassLoader classLoader, Str } catch (IOException ex) { throw new IllegalArgumentException( - "Failed to load configurations from location [" + location + "]", ex); + "Failed to load configurations from location [%s]".formatted(location), ex); } } @@ -131,7 +128,7 @@ private static List readCandidateConfigurations(URL url) { return candidates; } catch (IOException ex) { - throw new IllegalArgumentException("Unable to load configurations from location [" + url + "]", ex); + throw new IllegalArgumentException("Unable to load configurations from location [%s]".formatted(url), ex); } } diff --git a/today-context/src/main/java/cn/taketoday/context/annotation/config/TypeExcludeFilter.java b/today-context/src/main/java/cn/taketoday/context/annotation/config/TypeExcludeFilter.java index e4568e5dbd..1b4d82090f 100644 --- a/today-context/src/main/java/cn/taketoday/context/annotation/config/TypeExcludeFilter.java +++ b/today-context/src/main/java/cn/taketoday/context/annotation/config/TypeExcludeFilter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.annotation.config; @@ -85,12 +82,12 @@ private Collection getDelegates() { @Override public boolean equals(Object obj) { - throw new IllegalStateException("TypeExcludeFilter " + getClass() + " has not implemented equals"); + throw new IllegalStateException("TypeExcludeFilter %s has not implemented equals".formatted(getClass())); } @Override public int hashCode() { - throw new IllegalStateException("TypeExcludeFilter " + getClass() + " has not implemented hashCode"); + throw new IllegalStateException("TypeExcludeFilter %s has not implemented hashCode".formatted(getClass())); } } diff --git a/today-context/src/main/java/cn/taketoday/context/condition/AbstractNestedCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/AbstractNestedCondition.java index b5dfff1593..e88d690e7b 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/AbstractNestedCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/AbstractNestedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.condition; @@ -121,8 +121,8 @@ private void validateMemberCondition(Condition condition, ConfigurationPhase nes && condition instanceof ConfigurationCondition ccd) { ConfigurationPhase memberPhase = ccd.getConfigurationPhase(); if (memberPhase == ConfigurationPhase.REGISTER_BEAN) { - throw new IllegalStateException("Nested condition " + nestedClassName + " uses a configuration " - + "phase that is inappropriate for " + condition.getClass()); + throw new IllegalStateException("Nested condition %s uses a configuration phase that is inappropriate for %s" + .formatted(nestedClassName, condition.getClass())); } } } diff --git a/today-context/src/main/java/cn/taketoday/context/condition/AllNestedConditions.java b/today-context/src/main/java/cn/taketoday/context/condition/AllNestedConditions.java index b06870b410..35fcb700df 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/AllNestedConditions.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/AllNestedConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.condition; @@ -65,8 +65,7 @@ protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcom boolean match = hasSameSize(memberOutcomes.matches, memberOutcomes.all); List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("AllNestedConditions") - .because(memberOutcomes.matches.size() + - " matched " + memberOutcomes.nonMatches.size() + " did not")); + .because("%d matched %d did not".formatted(memberOutcomes.matches.size(), memberOutcomes.nonMatches.size()))); for (ConditionOutcome outcome : memberOutcomes.all) { messages.add(outcome.getConditionMessage()); diff --git a/today-context/src/main/java/cn/taketoday/context/condition/AnyNestedCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/AnyNestedCondition.java index 65fae52711..a3d463d3c6 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/AnyNestedCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/AnyNestedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.condition; @@ -65,7 +65,7 @@ protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcom boolean match = !memberOutcomes.matches.isEmpty(); List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("AnyNestedCondition") - .because(memberOutcomes.matches.size() + " matched " + memberOutcomes.nonMatches.size() + " did not")); + .because("%d matched %d did not".formatted(memberOutcomes.matches.size(), memberOutcomes.nonMatches.size()))); for (ConditionOutcome outcome : memberOutcomes.all) { messages.add(outcome.getConditionMessage()); diff --git a/today-context/src/main/java/cn/taketoday/context/condition/InfraCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/InfraCondition.java index d3b2923226..9a64f50828 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/InfraCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/InfraCondition.java @@ -50,11 +50,10 @@ public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) return outcome.isMatch(); } catch (NoClassDefFoundError ex) { - throw new IllegalStateException("Could not evaluate condition on " + classOrMethodName + " due to " - + ex.getMessage() + " not found. Make sure your own configuration does not rely on " - + "that class. This can also happen if you are " - + "@ComponentScanning a today-framework package (e.g. if you " - + "put a @ComponentScan in the default package by mistake)", ex); + throw new IllegalStateException(""" + Could not evaluate condition on %s due to %s not found. Make sure your own configuration does not rely on that class. \ + This can also happen if you are @ComponentScanning a today-framework package (e.g. if you put a @ComponentScan in the \ + default package by mistake)""".formatted(classOrMethodName, ex.getMessage()), ex); } catch (RuntimeException ex) { throw new IllegalStateException("Error processing condition on " + getName(metadata), ex); diff --git a/today-context/src/main/java/cn/taketoday/context/condition/NoneNestedConditions.java b/today-context/src/main/java/cn/taketoday/context/condition/NoneNestedConditions.java index b8491069df..00267d93c0 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/NoneNestedConditions.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/NoneNestedConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.condition; @@ -64,8 +64,7 @@ protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcom boolean match = memberOutcomes.matches.isEmpty(); List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("NoneNestedConditions") - .because(memberOutcomes.matches.size() - + " matched " + memberOutcomes.nonMatches.size() + " did not")); + .because("%d matched %d did not".formatted(memberOutcomes.matches.size(), memberOutcomes.nonMatches.size()))); for (ConditionOutcome outcome : memberOutcomes.all) { messages.add(outcome.getConditionMessage()); } diff --git a/today-context/src/main/java/cn/taketoday/context/condition/OnBeanCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/OnBeanCondition.java index 603dff6a27..74b51cb877 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/OnBeanCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/OnBeanCondition.java @@ -150,7 +150,7 @@ public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeM .noMatch(spec.message().found("multiple primary beans").items(Style.QUOTE, primaryBeans)); } matchMessage = spec.message(matchMessage) - .found("a single primary bean '" + primaryBeans.get(0) + "' from beans") + .found("a single primary bean '%s' from beans".formatted(primaryBeans.get(0))) .items(Style.QUOTE, allBeans); } } @@ -651,9 +651,8 @@ protected Set extractTypes(MultiValueMap attributes) { @Override protected void validate(BeanTypeDeductionException ex) { if (types.size() != 1) { - throw new IllegalArgumentException( - getAnnotationName() + " annotations must specify only one type (got " - + StringUtils.collectionToCommaDelimitedString(types) + ")"); + throw new IllegalArgumentException("%s annotations must specify only one type (got %s)" + .formatted(getAnnotationName(), StringUtils.collectionToCommaDelimitedString(types))); } } @@ -723,7 +722,7 @@ static final class BeanTypeDeductionException extends RuntimeException { private static final long serialVersionUID = 1L; private BeanTypeDeductionException(String className, String beanMethodName, Throwable cause) { - super("Failed to deduce bean type for " + className + "." + beanMethodName, cause); + super("Failed to deduce bean type for %s.%s".formatted(className, beanMethodName), cause); } } diff --git a/today-context/src/main/java/cn/taketoday/context/condition/OnClassCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/OnClassCondition.java index 4adb411f74..a11ea91afd 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/OnClassCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/OnClassCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.condition; @@ -56,8 +56,7 @@ protected ConditionOutcome[] getOutcomes(String[] configClasses, AutoConfigurati } } - private ConditionOutcome[] resolveOutcomesThreaded( - String[] configClasses, AutoConfigurationMetadata configMetadata) { + private ConditionOutcome[] resolveOutcomesThreaded(String[] configClasses, AutoConfigurationMetadata configMetadata) { int split = configClasses.length / 2; OutcomesResolver firstHalfResolver = createOutcomesResolver(configClasses, 0, split, configMetadata); OutcomesResolver secondHalfResolver = new StandardOutcomesResolver( diff --git a/today-context/src/main/java/cn/taketoday/context/condition/OnJndiCondition.java b/today-context/src/main/java/cn/taketoday/context/condition/OnJndiCondition.java index 7df1106ac4..967e112853 100644 --- a/today-context/src/main/java/cn/taketoday/context/condition/OnJndiCondition.java +++ b/today-context/src/main/java/cn/taketoday/context/condition/OnJndiCondition.java @@ -1,3 +1,20 @@ +/* + * Copyright 2017 - 2024 the original author or authors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see [https://www.gnu.org/licenses/] + */ + package cn.taketoday.context.condition; import javax.naming.NamingException; @@ -49,7 +66,7 @@ private ConditionOutcome getMatchOutcome(String[] locations) { if (location != null) { return ConditionOutcome.match( ConditionMessage.forCondition(ConditionalOnJndi.class, details) - .foundExactly("\"" + location + "\"") + .foundExactly("\"%s\"".formatted(location)) ); } return ConditionOutcome.noMatch( diff --git a/today-context/src/main/java/cn/taketoday/context/config/AbstractPropertyLoadingBeanDefinitionParser.java b/today-context/src/main/java/cn/taketoday/context/config/AbstractPropertyLoadingBeanDefinitionParser.java index 84e28f463a..8bdace179a 100644 --- a/today-context/src/main/java/cn/taketoday/context/config/AbstractPropertyLoadingBeanDefinitionParser.java +++ b/today-context/src/main/java/cn/taketoday/context/config/AbstractPropertyLoadingBeanDefinitionParser.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.config; @@ -34,6 +31,7 @@ * @author Juergen Hoeller * @author Arjen Poutsma * @author Dave Syer + * @author Harry Yang * @since 4.0 */ abstract class AbstractPropertyLoadingBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { diff --git a/today-context/src/main/java/cn/taketoday/context/event/AbstractApplicationEventMulticaster.java b/today-context/src/main/java/cn/taketoday/context/event/AbstractApplicationEventMulticaster.java index 4b1751b7fc..8600c59c79 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/AbstractApplicationEventMulticaster.java +++ b/today-context/src/main/java/cn/taketoday/context/event/AbstractApplicationEventMulticaster.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.event; @@ -338,9 +338,7 @@ private Collection> retrieveApplicationListeners( * @see #supportsEvent(Class, ResolvableType) * @see #supportsEvent(ApplicationListener, ResolvableType, Class) */ - private boolean supportsEvent( - ConfigurableBeanFactory beanFactory, String listenerBeanName, ResolvableType eventType) { - + private boolean supportsEvent(ConfigurableBeanFactory beanFactory, String listenerBeanName, ResolvableType eventType) { Class listenerType = beanFactory.getType(listenerBeanName); if (listenerType == null || GenericApplicationListener.class.isAssignableFrom(listenerType) @@ -395,7 +393,7 @@ protected boolean supportsEvent(Class listenerType, ResolvableType eventType) protected boolean supportsEvent(ApplicationListener listener, ResolvableType eventType, @Nullable Class sourceType) { GenericApplicationListener smartListener = listener instanceof GenericApplicationListener - ? (GenericApplicationListener) listener : new GenericApplicationListenerAdapter(listener); + ? (GenericApplicationListener) listener : new GenericApplicationListenerAdapter(listener); return smartListener.supportsEventType(eventType) && smartListener.supportsSourceType(sourceType); } diff --git a/today-context/src/main/java/cn/taketoday/context/event/ApplicationListenerMethodAdapter.java b/today-context/src/main/java/cn/taketoday/context/event/ApplicationListenerMethodAdapter.java index 0d074c0cd7..af6fe0ae39 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/ApplicationListenerMethodAdapter.java +++ b/today-context/src/main/java/cn/taketoday/context/event/ApplicationListenerMethodAdapter.java @@ -447,11 +447,8 @@ protected void handleAsyncError(Throwable t) { * @param message error message to append the HandlerMethod details to */ protected String getDetailedErrorMessage(Object bean, String message) { - StringBuilder sb = new StringBuilder(message).append('\n'); - sb.append("HandlerMethod details: \n"); - sb.append("Bean [").append(bean.getClass().getName()).append("]\n"); - sb.append("Method [").append(this.targetMethod.toGenericString()).append("]\n"); - return sb.toString(); + return "%s\nHandlerMethod details: \nBean [%s]\nMethod [%s]\n" + .formatted(message, bean.getClass().getName(), this.targetMethod.toGenericString()); } /** @@ -465,10 +462,9 @@ private void assertTargetBean(Method method, Object targetBean, Object[] args) { Class methodDeclaringClass = method.getDeclaringClass(); Class targetBeanClass = targetBean.getClass(); if (!methodDeclaringClass.isAssignableFrom(targetBeanClass)) { - String msg = "The event listener method class '" + methodDeclaringClass.getName() + - "' is not an instance of the actual bean class '" + - targetBeanClass.getName() + "'. If the bean requires proxying " + - "(e.g. due to @Transactional), please use class-based proxying."; + String msg = ("The event listener method class '%s' is not an instance of the actual bean class '%s'. " + + "If the bean requires proxying (e.g. due to @Transactional), please use class-based proxying.") + .formatted(methodDeclaringClass.getName(), targetBeanClass.getName()); throw new IllegalStateException(getInvocationErrorMessage(targetBean, msg, args)); } } diff --git a/today-context/src/main/java/cn/taketoday/context/event/ContextStartedEvent.java b/today-context/src/main/java/cn/taketoday/context/event/ContextStartedEvent.java index 80e50c866e..8ae5c5aec4 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/ContextStartedEvent.java +++ b/today-context/src/main/java/cn/taketoday/context/event/ContextStartedEvent.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,8 +12,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see [https://www.gnu.org/licenses/] */ + package cn.taketoday.context.event; import cn.taketoday.context.ApplicationContext; @@ -24,8 +22,8 @@ /** * Event raised when an {@code ApplicationContext} gets started. * - * @author TODAY
- * 2018-09-10 10:52 + * @author Harry Yang + * @since 2018-09-10 10:52 */ @SuppressWarnings("serial") public class ContextStartedEvent extends ApplicationContextEvent { diff --git a/today-context/src/main/java/cn/taketoday/context/event/ContextStoppedEvent.java b/today-context/src/main/java/cn/taketoday/context/event/ContextStoppedEvent.java index 2d8eec6231..ea0a6353e5 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/ContextStoppedEvent.java +++ b/today-context/src/main/java/cn/taketoday/context/event/ContextStoppedEvent.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,8 +12,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see [https://www.gnu.org/licenses/] */ + package cn.taketoday.context.event; import cn.taketoday.context.ApplicationContext; diff --git a/today-context/src/main/java/cn/taketoday/context/event/EventListenerFactory.java b/today-context/src/main/java/cn/taketoday/context/event/EventListenerFactory.java index be06a837d5..6ce0fb51c3 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/EventListenerFactory.java +++ b/today-context/src/main/java/cn/taketoday/context/event/EventListenerFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.event; @@ -29,6 +26,7 @@ * annotated with {@link EventListener}. * * @author Stephane Nicoll + * @author Harry Yang * @since 4.0 */ public interface EventListenerFactory { diff --git a/today-context/src/main/java/cn/taketoday/context/event/EventListenerMethodProcessor.java b/today-context/src/main/java/cn/taketoday/context/event/EventListenerMethodProcessor.java index ad7ae8eecd..3e6459137d 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/EventListenerMethodProcessor.java +++ b/today-context/src/main/java/cn/taketoday/context/event/EventListenerMethodProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.event; @@ -116,8 +116,8 @@ public void afterSingletonsInstantiated(ConfigurableBeanFactory beanFactory) { process(beanName, type, factories, evaluator, nonAnnotatedClasses); } catch (Throwable ex) { - throw new BeanInitializationException("Failed to process @EventListener " + - "annotation on bean with name '" + beanName + "': " + ex.getMessage(), ex); + throw new BeanInitializationException("Failed to process @EventListener annotation on bean with name '%s': %s" + .formatted(beanName, ex.getMessage()), ex); } } } diff --git a/today-context/src/main/java/cn/taketoday/context/event/EventPublicationInterceptor.java b/today-context/src/main/java/cn/taketoday/context/event/EventPublicationInterceptor.java index 1f44676c06..67c951f689 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/EventPublicationInterceptor.java +++ b/today-context/src/main/java/cn/taketoday/context/event/EventPublicationInterceptor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.event; @@ -53,8 +50,7 @@ * @see cn.taketoday.context.ApplicationContext * @since 4.0 2021/12/3 10:11 */ -public class EventPublicationInterceptor - implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean { +public class EventPublicationInterceptor implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean { @Nullable private Constructor applicationEventConstructor; @@ -83,8 +79,8 @@ public void setApplicationEventClass(Class applicationEventClass) { this.applicationEventConstructor = applicationEventClass.getConstructor(Object.class); } catch (NoSuchMethodException ex) { - throw new IllegalArgumentException("ApplicationEvent class [" + - applicationEventClass.getName() + "] does not have the required Object constructor: " + ex); + throw new IllegalArgumentException("ApplicationEvent class [%s] does not have the required Object constructor: %s" + .formatted(applicationEventClass.getName(), ex)); } } diff --git a/today-context/src/main/java/cn/taketoday/context/event/GenericApplicationListenerAdapter.java b/today-context/src/main/java/cn/taketoday/context/event/GenericApplicationListenerAdapter.java index b05ca11771..8445308926 100644 --- a/today-context/src/main/java/cn/taketoday/context/event/GenericApplicationListenerAdapter.java +++ b/today-context/src/main/java/cn/taketoday/context/event/GenericApplicationListenerAdapter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.event; @@ -37,6 +34,7 @@ * * @author Juergen Hoeller * @author Stephane Nicoll + * @author Harry Yang * @see ApplicationListener#onApplicationEvent * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/context/expression/BeanFactoryAccessor.java b/today-context/src/main/java/cn/taketoday/context/expression/BeanFactoryAccessor.java index 00b8c3c2dc..3c82675340 100644 --- a/today-context/src/main/java/cn/taketoday/context/expression/BeanFactoryAccessor.java +++ b/today-context/src/main/java/cn/taketoday/context/expression/BeanFactoryAccessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.expression; @@ -34,6 +31,7 @@ * * @author Juergen Hoeller * @author Andy Clement + * @author Harry Yang * @since 3.0 */ public class BeanFactoryAccessor implements PropertyAccessor { diff --git a/today-context/src/main/java/cn/taketoday/context/expression/CachedExpressionEvaluator.java b/today-context/src/main/java/cn/taketoday/context/expression/CachedExpressionEvaluator.java index ab65618a84..0e7386a0c7 100644 --- a/today-context/src/main/java/cn/taketoday/context/expression/CachedExpressionEvaluator.java +++ b/today-context/src/main/java/cn/taketoday/context/expression/CachedExpressionEvaluator.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.expression; @@ -131,7 +131,7 @@ public int hashCode() { @Override public String toString() { - return this.element + " with expression \"" + this.expression + "\""; + return "%s with expression \"%s\"".formatted(this.element, this.expression); } @Override diff --git a/today-context/src/main/java/cn/taketoday/context/expression/EnvironmentAccessor.java b/today-context/src/main/java/cn/taketoday/context/expression/EnvironmentAccessor.java index 27a2e98356..1e7c2e24ee 100644 --- a/today-context/src/main/java/cn/taketoday/context/expression/EnvironmentAccessor.java +++ b/today-context/src/main/java/cn/taketoday/context/expression/EnvironmentAccessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.expression; @@ -33,6 +30,7 @@ * of a {@link Environment} instance. * * @author Chris Beams + * @author Harry Yang * @since 4.0 */ public class EnvironmentAccessor implements PropertyAccessor { diff --git a/today-context/src/main/java/cn/taketoday/context/expression/MapAccessor.java b/today-context/src/main/java/cn/taketoday/context/expression/MapAccessor.java index 43ef5ebaf4..a76165d734 100644 --- a/today-context/src/main/java/cn/taketoday/context/expression/MapAccessor.java +++ b/today-context/src/main/java/cn/taketoday/context/expression/MapAccessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.expression; @@ -38,6 +35,7 @@ * * @author Juergen Hoeller * @author Andy Clement + * @author Harry Yang * @since 4.0 */ public class MapAccessor implements CompilablePropertyAccessor { diff --git a/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBeanRegistrar.java b/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBeanRegistrar.java index 6969c2f193..cc05c02e20 100644 --- a/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBeanRegistrar.java +++ b/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBeanRegistrar.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.properties; @@ -89,9 +86,7 @@ private boolean containsBeanDefinition(@Nullable BeanFactory beanFactory, String private void registerBeanDefinition(String beanName, Class type, MergedAnnotation annotation) { if (!annotation.isPresent()) { - throw new IllegalStateException( - "No " + ConfigurationProperties.class.getSimpleName() - + " annotation found on '" + type.getName() + "'."); + throw new IllegalStateException("No %s annotation found on '%s'.".formatted(ConfigurationProperties.class.getSimpleName(), type.getName())); } this.registry.registerBeanDefinition(beanName, createBeanDefinition(beanName, type)); } diff --git a/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 231a22a27c..f084efd77b 100644 --- a/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/today-context/src/main/java/cn/taketoday/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.properties; @@ -94,9 +94,8 @@ private void bind(@Nullable ConfigurationPropertiesBean bean) { return; } if (bean.asBindTarget().getBindMethod() == BindMethod.VALUE_OBJECT) { - throw new IllegalStateException( - "Cannot bind @ConfigurationProperties for bean '" + bean.getName() + - "'. Ensure that @ConstructorBinding has not been applied to regular bean"); + throw new IllegalStateException("Cannot bind @ConfigurationProperties for bean '%s'. Ensure that @ConstructorBinding has not been applied to regular bean" + .formatted(bean.getName())); } try { this.binder.bind(bean); diff --git a/today-context/src/main/java/cn/taketoday/context/support/ApplicationListenerDetector.java b/today-context/src/main/java/cn/taketoday/context/support/ApplicationListenerDetector.java index de6a829da6..868c206c03 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/ApplicationListenerDetector.java +++ b/today-context/src/main/java/cn/taketoday/context/support/ApplicationListenerDetector.java @@ -45,6 +45,7 @@ * defensively mark this post-processor's field state as {@code transient}. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ final class ApplicationListenerDetector diff --git a/today-context/src/main/java/cn/taketoday/context/support/ApplicationObjectSupport.java b/today-context/src/main/java/cn/taketoday/context/support/ApplicationObjectSupport.java index 7dcc0f5221..0f968c0a43 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/ApplicationObjectSupport.java +++ b/today-context/src/main/java/cn/taketoday/context/support/ApplicationObjectSupport.java @@ -69,7 +69,7 @@ else if (this.applicationContext == null) { // Initialize with passed-in context. if (!requiredContextClass().isInstance(context)) { throw new ApplicationContextException( - "Invalid application context: needs to be of type [" + requiredContextClass().getName() + "]"); + "Invalid application context: needs to be of type [%s]".formatted(requiredContextClass().getName())); } this.applicationContext = context; initApplicationContext(context); @@ -77,9 +77,8 @@ else if (this.applicationContext == null) { else { // Ignore reinitialization if same context passed in. if (this.applicationContext != context) { - throw new ApplicationContextException( - "Cannot reinitialize with different application context: current one is [" + - this.applicationContext + "], passed-in one is [" + context + "]"); + throw new ApplicationContextException("Cannot reinitialize with different application context: current one is [%s], passed-in one is [%s]" + .formatted(this.applicationContext, context)); } } } @@ -124,7 +123,7 @@ public final ApplicationContext getApplicationContext() throws IllegalStateExcep ApplicationContext context = this.applicationContext; if (context == null && isContextRequired()) { throw new IllegalStateException( - "ApplicationContextSupport instance [" + this + "] does not run in an ApplicationContext"); + "ApplicationContextSupport instance [%s] does not run in an ApplicationContext".formatted(this)); } return context; } @@ -176,7 +175,7 @@ protected final MessageSourceAccessor getMessageSourceAccessor() throws IllegalS if (context == null) { if (isContextRequired()) { throw new IllegalStateException( - "ApplicationObjectSupport instance [" + this + "] does not run in an ApplicationContext"); + "ApplicationObjectSupport instance [%s] does not run in an ApplicationContext".formatted(this)); } return null; } diff --git a/today-context/src/main/java/cn/taketoday/context/support/DefaultLifecycleProcessor.java b/today-context/src/main/java/cn/taketoday/context/support/DefaultLifecycleProcessor.java index a1c1efbfed..af5836d752 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/DefaultLifecycleProcessor.java +++ b/today-context/src/main/java/cn/taketoday/context/support/DefaultLifecycleProcessor.java @@ -290,7 +290,7 @@ private void doStart(Map lifecycleBeans, String bea bean.start(); } catch (Throwable ex) { - throw new ApplicationContextException("Failed to start bean '" + beanName + "'", ex); + throw new ApplicationContextException("Failed to start bean '%s'".formatted(beanName), ex); } log.debug("Successfully started bean '{}'", beanName); } @@ -487,9 +487,8 @@ else if (member.bean instanceof SmartLifecycle) { try { latch.await(timeout, TimeUnit.MILLISECONDS); if (latch.getCount() > 0 && !countDownBeanNames.isEmpty() && log.isInfoEnabled()) { - log.info("Shutdown phase " + this.phase + " ends with " + countDownBeanNames.size() + - " bean" + (countDownBeanNames.size() > 1 ? "s" : "") + - " still running after timeout of " + this.timeout + "ms: " + countDownBeanNames); + log.info("Shutdown phase %d ends with %d bean%s still running after timeout of %dms: %s" + .formatted(this.phase, countDownBeanNames.size(), countDownBeanNames.size() > 1 ? "s" : "", this.timeout, countDownBeanNames)); } } catch (InterruptedException ex) { diff --git a/today-context/src/main/java/cn/taketoday/context/support/DefaultMessageSourceResolvable.java b/today-context/src/main/java/cn/taketoday/context/support/DefaultMessageSourceResolvable.java index 7eb84b81cd..9bc39379c3 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/DefaultMessageSourceResolvable.java +++ b/today-context/src/main/java/cn/taketoday/context/support/DefaultMessageSourceResolvable.java @@ -91,9 +91,7 @@ public DefaultMessageSourceResolvable(String[] codes, Object[] arguments) { * @param arguments the array of arguments to be used to resolve this message * @param defaultMessage the default message to be used to resolve this message */ - public DefaultMessageSourceResolvable( - @Nullable String[] codes, @Nullable Object[] arguments, @Nullable String defaultMessage) { - + public DefaultMessageSourceResolvable(@Nullable String[] codes, @Nullable Object[] arguments, @Nullable String defaultMessage) { this.codes = codes; this.arguments = arguments; this.defaultMessage = defaultMessage; @@ -155,11 +153,9 @@ public boolean shouldRenderDefaultMessage() { * including codes, arguments, and default message. */ protected final String resolvableToString() { - StringBuilder result = new StringBuilder(64); - result.append("codes [").append(StringUtils.arrayToDelimitedString(this.codes, ",")); - result.append("]; arguments [").append(StringUtils.arrayToDelimitedString(this.arguments, ",")); - result.append("]; default message [").append(this.defaultMessage).append(']'); - return result.toString(); + return "codes [%s]; arguments [%s]; default message [%s]".formatted( + StringUtils.arrayToDelimitedString(this.codes, ","), + StringUtils.arrayToDelimitedString(this.arguments, ","), this.defaultMessage); } /** diff --git a/today-context/src/main/java/cn/taketoday/context/support/DelegatingMessageSource.java b/today-context/src/main/java/cn/taketoday/context/support/DelegatingMessageSource.java index 52ec582572..36a12af35e 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/DelegatingMessageSource.java +++ b/today-context/src/main/java/cn/taketoday/context/support/DelegatingMessageSource.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -36,6 +33,7 @@ * define its own MessageSource. Not intended for direct use in applications. * * @author Juergen Hoeller + * @author Harry Yang * @see AbstractApplicationContext * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/context/support/MessageSourceAccessor.java b/today-context/src/main/java/cn/taketoday/context/support/MessageSourceAccessor.java index 25c7f250dd..9645302796 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/MessageSourceAccessor.java +++ b/today-context/src/main/java/cn/taketoday/context/support/MessageSourceAccessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -36,6 +33,7 @@ * as a standalone helper to delegate to in application objects. * * @author Juergen Hoeller + * @author Harry Yang * @see ApplicationObjectSupport#getMessageSourceAccessor * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/context/support/MessageSourceResourceBundle.java b/today-context/src/main/java/cn/taketoday/context/support/MessageSourceResourceBundle.java index 4e9aca0c7e..cc8b97bea0 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/MessageSourceResourceBundle.java +++ b/today-context/src/main/java/cn/taketoday/context/support/MessageSourceResourceBundle.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -35,6 +32,7 @@ * Used for example to expose a Framework MessageSource to JSTL web views. * * @author Juergen Hoeller + * @author Harry Yang * @see cn.taketoday.context.MessageSource * @see java.util.ResourceBundle * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/context/support/ResourceBundleMessageSource.java b/today-context/src/main/java/cn/taketoday/context/support/ResourceBundleMessageSource.java index cbb6b1a465..d7659bedb9 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/ResourceBundleMessageSource.java +++ b/today-context/src/main/java/cn/taketoday/context/support/ResourceBundleMessageSource.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -73,13 +70,13 @@ * @author Rod Johnson * @author Juergen Hoeller * @author Qimiao Chen + * @author Harry Yang * @see #setBasenames * @see ReloadableResourceBundleMessageSource * @see java.util.ResourceBundle * @see java.text.MessageFormat */ -public class ResourceBundleMessageSource - extends AbstractResourceBasedMessageSource implements BeanClassLoaderAware { +public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSource implements BeanClassLoaderAware { @Nullable private ClassLoader bundleClassLoader; @@ -94,7 +91,7 @@ public class ResourceBundleMessageSource * This allows for very efficient hash lookups, significantly faster * than the ResourceBundle class's own cache. */ - private final Map> cachedResourceBundles = + private final ConcurrentHashMap> cachedResourceBundles = new ConcurrentHashMap<>(); /** @@ -106,7 +103,7 @@ public class ResourceBundleMessageSource * * @see #getMessageFormat */ - private final Map>> cachedBundleMessageFormats = + private final ConcurrentHashMap>> cachedBundleMessageFormats = new ConcurrentHashMap<>(); @Nullable @@ -218,7 +215,7 @@ protected ResourceBundle getResourceBundle(String basename, Locale locale) { } catch (MissingResourceException ex) { if (logger.isWarnEnabled()) { - logger.warn("ResourceBundle [" + basename + "] not found for MessageSource: " + ex.getMessage()); + logger.warn("ResourceBundle [{}] not found for MessageSource: {}", basename, ex.getMessage()); } // Assume bundle not found // -> do NOT throw the exception to allow for checking parent message source. @@ -251,11 +248,11 @@ protected ResourceBundle doGetBundle(String basename, Locale locale) throws Miss this.control = null; String encoding = getDefaultEncoding(); if (encoding != null && logger.isInfoEnabled()) { - logger.info("ResourceBundleMessageSource is configured to read resources with encoding '" + - encoding + "' but ResourceBundle.Control not supported in current system environment: " + - ex.getMessage() + " - falling back to plain ResourceBundle.getBundle retrieval with the " + - "platform default encoding. Consider setting the 'defaultEncoding' property to 'null' " + - "for participating in the platform default and therefore avoiding this log message."); + logger.info(""" + ResourceBundleMessageSource is configured to read resources with encoding '%s' but ResourceBundle.Control not supported \ + in current system environment: %s - falling back to plain ResourceBundle.getBundle retrieval with the platform default \ + encoding. Consider setting the 'defaultEncoding' property to 'null' for participating in the platform default and \ + therefore avoiding this log message.""".formatted(encoding, ex.getMessage())); } } } @@ -451,9 +448,7 @@ public long getTimeToLive(String baseName, Locale locale) { } @Override - public boolean needsReload( - String baseName, Locale locale, String format, ClassLoader loader, ResourceBundle bundle, long loadTime) { - + public boolean needsReload(String baseName, Locale locale, String format, ClassLoader loader, ResourceBundle bundle, long loadTime) { if (super.needsReload(baseName, locale, format, loader, bundle, loadTime)) { cachedBundleMessageFormats.remove(bundle); return true; diff --git a/today-context/src/main/java/cn/taketoday/context/support/StaticApplicationContext.java b/today-context/src/main/java/cn/taketoday/context/support/StaticApplicationContext.java index 11e10bb9e2..47b160f281 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/StaticApplicationContext.java +++ b/today-context/src/main/java/cn/taketoday/context/support/StaticApplicationContext.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -34,6 +31,7 @@ * * @author Rod Johnson * @author Juergen Hoeller + * @author Harry Yang * @see #registerSingleton * @see #registerPrototype * @see #registerBeanDefinition diff --git a/today-context/src/main/java/cn/taketoday/context/support/StaticMessageSource.java b/today-context/src/main/java/cn/taketoday/context/support/StaticMessageSource.java index e5076fc8ae..7c5454e7b4 100644 --- a/today-context/src/main/java/cn/taketoday/context/support/StaticMessageSource.java +++ b/today-context/src/main/java/cn/taketoday/context/support/StaticMessageSource.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2021 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.support; @@ -37,6 +34,7 @@ * * @author Rod Johnson * @author Juergen Hoeller + * @author Harry Yang */ public class StaticMessageSource extends AbstractMessageSource { diff --git a/today-context/src/main/java/cn/taketoday/context/weaving/AspectJWeavingEnabler.java b/today-context/src/main/java/cn/taketoday/context/weaving/AspectJWeavingEnabler.java index c152bb08bd..d99955dd0f 100644 --- a/today-context/src/main/java/cn/taketoday/context/weaving/AspectJWeavingEnabler.java +++ b/today-context/src/main/java/cn/taketoday/context/weaving/AspectJWeavingEnabler.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,8 +12,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ + package cn.taketoday.context.weaving; import org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter; @@ -29,9 +27,9 @@ import cn.taketoday.beans.factory.BeanClassLoaderAware; import cn.taketoday.beans.factory.config.BeanFactoryPostProcessor; import cn.taketoday.beans.factory.config.ConfigurableBeanFactory; +import cn.taketoday.core.Ordered; import cn.taketoday.instrument.classloading.InstrumentationLoadTimeWeaver; import cn.taketoday.instrument.classloading.LoadTimeWeaver; -import cn.taketoday.core.Ordered; import cn.taketoday.lang.Nullable; /** @@ -42,10 +40,10 @@ * * @author Juergen Hoeller * @author Ramnivas Laddad + * @author Harry Yang * @since 4.0 */ -public class AspectJWeavingEnabler - implements BeanFactoryPostProcessor, BeanClassLoaderAware, LoadTimeWeaverAware, Ordered { +public class AspectJWeavingEnabler implements BeanFactoryPostProcessor, BeanClassLoaderAware, LoadTimeWeaverAware, Ordered { /** * The {@code aop.xml} resource location. diff --git a/today-context/src/main/java/cn/taketoday/context/weaving/DefaultContextLoadTimeWeaver.java b/today-context/src/main/java/cn/taketoday/context/weaving/DefaultContextLoadTimeWeaver.java index 934e320ea6..0a193d7e43 100644 --- a/today-context/src/main/java/cn/taketoday/context/weaving/DefaultContextLoadTimeWeaver.java +++ b/today-context/src/main/java/cn/taketoday/context/weaving/DefaultContextLoadTimeWeaver.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.weaving; @@ -24,8 +21,8 @@ import cn.taketoday.beans.factory.BeanClassLoaderAware; import cn.taketoday.beans.factory.DisposableBean; -import cn.taketoday.instrument.classloading.InstrumentationLoadTimeWeaver; import cn.taketoday.instrument.InstrumentationSavingAgent; +import cn.taketoday.instrument.classloading.InstrumentationLoadTimeWeaver; import cn.taketoday.instrument.classloading.LoadTimeWeaver; import cn.taketoday.instrument.classloading.ReflectiveLoadTimeWeaver; import cn.taketoday.instrument.classloading.TomcatLoadTimeWeaver; @@ -51,6 +48,7 @@ * @author Juergen Hoeller * @author Ramnivas Laddad * @author Costin Leau + * @author Harry Yang * @see cn.taketoday.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/context/weaving/LoadTimeWeaverAwareProcessor.java b/today-context/src/main/java/cn/taketoday/context/weaving/LoadTimeWeaverAwareProcessor.java index fba5e49758..7287855da8 100644 --- a/today-context/src/main/java/cn/taketoday/context/weaving/LoadTimeWeaverAwareProcessor.java +++ b/today-context/src/main/java/cn/taketoday/context/weaving/LoadTimeWeaverAwareProcessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.context.weaving; @@ -41,6 +38,7 @@ *

Applications should not use this class directly. * * @author Juergen Hoeller + * @author Harry Yang * @see LoadTimeWeaverAware * @see cn.taketoday.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatter.java index 489753c7ae..b0e772570f 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime; @@ -46,6 +43,7 @@ * @author Juergen Hoeller * @author Phillip Webb * @author Sam Brannen + * @author Harry Yang * @see SimpleDateFormat * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatterRegistrar.java b/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatterRegistrar.java index 69360f5b7a..3d56f8685f 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatterRegistrar.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/DateFormatterRegistrar.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime; @@ -40,6 +37,7 @@ * ad-hoc use against any {@code ConverterRegistry} instance. * * @author Phillip Webb + * @author Harry Yang * @see cn.taketoday.format.datetime.standard.DateTimeFormatterRegistrar * @see FormatterRegistrar#registerFormatters * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/DateTimeFormatAnnotationFormatterFactory.java b/today-context/src/main/java/cn/taketoday/format/datetime/DateTimeFormatAnnotationFormatterFactory.java index 74af40b431..30bea294ce 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/DateTimeFormatAnnotationFormatterFactory.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/DateTimeFormatAnnotationFormatterFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime; @@ -38,6 +35,7 @@ * * @author Phillip Webb * @author Sam Brannen + * @author Harry Yang * @since 4.0 */ public class DateTimeFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContext.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContext.java index aabfc143d0..7f659a5fa9 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContext.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContext.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -36,6 +33,7 @@ *

A {@code null} property value indicates the user has not specified a setting. * * @author Juergen Hoeller + * @author Harry Yang * @see DateTimeContextHolder * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContextHolder.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContextHolder.java index a2b3b0b9d4..a36990f73b 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContextHolder.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeContextHolder.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -30,6 +27,7 @@ * A holder for a thread-local user {@link DateTimeContext}. * * @author Juergen Hoeller + * @author Harry Yang * @see cn.taketoday.core.i18n.LocaleContextHolder * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeConverters.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeConverters.java index 298aafc959..9025b98d50 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeConverters.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeConverters.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -43,6 +40,7 @@ * and also between {@link Calendar} and JSR-310 value types. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ final class DateTimeConverters { diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactory.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactory.java index b919b6d2c6..3facd8836a 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactory.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -38,6 +35,7 @@ * @author Juergen Hoeller * @author Phillip Webb * @author Sam Brannen + * @author Harry Yang * @see #createDateTimeFormatter() * @see #createDateTimeFormatter(DateTimeFormatter) * @see #setPattern diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactoryBean.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactoryBean.java index 3cec60eee2..d132bce898 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactoryBean.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterFactoryBean.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * See the {@link DateTimeFormatterFactory base class} for configuration details. * * @author Juergen Hoeller + * @author Harry Yang * @see #setPattern * @see #setIso * @see #setDateStyle diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterRegistrar.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterRegistrar.java index 48c8f6df6e..e64f616313 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterRegistrar.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterRegistrar.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -46,6 +43,7 @@ * * @author Juergen Hoeller * @author Phillip Webb + * @author Harry Yang * @see #setDateStyle * @see #setTimeStyle * @see #setDateTimeStyle diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterUtils.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterUtils.java index e73f523293..2a11a6a92a 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterUtils.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DateTimeFormatterUtils.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -29,6 +26,7 @@ * Internal {@link DateTimeFormatter} utilities. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ abstract class DateTimeFormatterUtils { diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DurationFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DurationFormatter.java index 42807165fa..4445abe04a 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/DurationFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/DurationFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * following JSR-310's parsing rules for a Duration. * * @author Juergen Hoeller + * @author Harry Yang * @see Duration#parse * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/InstantFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/InstantFormatter.java index 22f93a87de..62c7c2a8b6 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/InstantFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/InstantFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -36,6 +33,7 @@ * * @author Juergen Hoeller * @author Andrei Nevedomskii + * @author Harry Yang * @see Instant#parse * @see DateTimeFormatter#ISO_INSTANT * @see DateTimeFormatter#RFC_1123_DATE_TIME @@ -49,7 +47,7 @@ public Instant parse(String text, Locale locale) throws ParseException { return Instant.ofEpochMilli(Long.parseLong(text)); } catch (NumberFormatException ex) { - if (text.length() > 0 && Character.isAlphabetic(text.charAt(0))) { + if (!text.isEmpty() && Character.isAlphabetic(text.charAt(0))) { // assuming RFC-1123 value a la "Tue, 3 Jun 2008 11:05:30 GMT" return Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(text)); } diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/Jsr310DateTimeFormatAnnotationFormatterFactory.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/Jsr310DateTimeFormatAnnotationFormatterFactory.java index 9fbcae085b..8d2698c379 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/Jsr310DateTimeFormatAnnotationFormatterFactory.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/Jsr310DateTimeFormatAnnotationFormatterFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -48,6 +45,7 @@ * @author Juergen Hoeller * @author Sam Brannen * @author Kazuki Shimizu + * @author Harry Yang * @see DateTimeFormat * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthDayFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthDayFormatter.java index 44597c675d..4a2d388431 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthDayFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthDayFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * following JSR-310's parsing rules for a MonthDay. * * @author Juergen Hoeller + * @author Harry Yang * @see MonthDay#parse * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthFormatter.java index e9e1307040..e424190d64 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/MonthFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * resolving a given String against the Month enum values (ignoring case). * * @author Juergen Hoeller + * @author Harry Yang * @see Month#valueOf * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/PeriodFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/PeriodFormatter.java index 9235d8cb73..3430e47c06 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/PeriodFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/PeriodFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * following JSR-310's parsing rules for a Period. * * @author Juergen Hoeller + * @author Harry Yang * @see Period#parse * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/TemporalAccessorPrinter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/TemporalAccessorPrinter.java index 13f7057fa6..80621e3703 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/TemporalAccessorPrinter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/TemporalAccessorPrinter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * using a {@link DateTimeFormatter}) (the contextual one, if available). * * @author Juergen Hoeller + * @author Harry Yang * @see DateTimeContextHolder#getFormatter * @see DateTimeFormatter#format(TemporalAccessor) * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearFormatter.java index 591c664334..d4a0b119f3 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * following JSR-310's parsing rules for a Year. * * @author Juergen Hoeller + * @author Harry Yang * @see Year#parse * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearMonthFormatter.java b/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearMonthFormatter.java index b8f269dd73..8664f5c585 100644 --- a/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearMonthFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/datetime/standard/YearMonthFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.datetime.standard; @@ -31,6 +28,7 @@ * following JSR-310's parsing rules for a YearMonth. * * @author Juergen Hoeller + * @author Harry Yang * @see YearMonth#parse * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/number/AbstractNumberFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/AbstractNumberFormatter.java index eba6489ddc..8e7d4e7f81 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/AbstractNumberFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/AbstractNumberFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number; @@ -32,6 +29,7 @@ * providing a {@link #getNumberFormat(Locale)} template method. * * @author Juergen Hoeller + * @author Harry Yang * @author Keith Donald * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/number/CurrencyStyleFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/CurrencyStyleFormatter.java index d375192d1b..c6640c792f 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/CurrencyStyleFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/CurrencyStyleFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number; @@ -39,6 +36,7 @@ * * @author Keith Donald * @author Juergen Hoeller + * @author Harry Yang * @see #setLenient * @see #setRoundingMode * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/format/number/NumberFormatAnnotationFormatterFactory.java b/today-context/src/main/java/cn/taketoday/format/number/NumberFormatAnnotationFormatterFactory.java index b593968fbe..9864b0487a 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/NumberFormatAnnotationFormatterFactory.java +++ b/today-context/src/main/java/cn/taketoday/format/number/NumberFormatAnnotationFormatterFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number; @@ -37,6 +34,7 @@ * * @author Keith Donald * @author Juergen Hoeller + * @author Harry Yang * @see NumberFormat * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/number/NumberStyleFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/NumberStyleFormatter.java index d715c3d1c0..56176905bb 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/NumberStyleFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/NumberStyleFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number; @@ -36,6 +33,7 @@ * * @author Keith Donald * @author Juergen Hoeller + * @author Harry Yang * @see #setPattern * @see #setLenient * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/format/number/PercentStyleFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/PercentStyleFormatter.java index 387958c1e3..514876ed00 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/PercentStyleFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/PercentStyleFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number; @@ -33,6 +30,7 @@ * * @author Keith Donald * @author Juergen Hoeller + * @author Harry Yang * @see #setLenient * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/number/money/CurrencyUnitFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/money/CurrencyUnitFormatter.java index 40f6580234..1734bdc448 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/money/CurrencyUnitFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/money/CurrencyUnitFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number.money; @@ -32,6 +29,7 @@ * from and to currency code Strings. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public class CurrencyUnitFormatter implements Formatter { diff --git a/today-context/src/main/java/cn/taketoday/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java b/today-context/src/main/java/cn/taketoday/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java index 964fe5a817..92722f5ecf 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java +++ b/today-context/src/main/java/cn/taketoday/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number.money; @@ -47,6 +44,7 @@ * with Framework's common {@link NumberFormat} annotation. * * @author Juergen Hoeller + * @author Harry Yang * @see NumberFormat * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/format/number/money/MonetaryAmountFormatter.java b/today-context/src/main/java/cn/taketoday/format/number/money/MonetaryAmountFormatter.java index f325fd78b5..0f5d7fffa5 100644 --- a/today-context/src/main/java/cn/taketoday/format/number/money/MonetaryAmountFormatter.java +++ b/today-context/src/main/java/cn/taketoday/format/number/money/MonetaryAmountFormatter.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.format.number.money; @@ -35,6 +32,7 @@ * and {@link javax.money.format.MonetaryAmountFormat#parse}. * * @author Juergen Hoeller + * @author Harry Yang * @see #getMonetaryAmountFormat * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/ui/ConcurrentModel.java b/today-context/src/main/java/cn/taketoday/ui/ConcurrentModel.java index 8ff166375a..9386388105 100644 --- a/today-context/src/main/java/cn/taketoday/ui/ConcurrentModel.java +++ b/today-context/src/main/java/cn/taketoday/ui/ConcurrentModel.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.ui; @@ -39,6 +36,7 @@ * likely a {@code java.util.ConcurrentMap}, for a pre-determined model. * * @author Rossen Stoyanchev + * @author Harry Yang * @since 4.0 */ @SuppressWarnings("serial") diff --git a/today-context/src/main/java/cn/taketoday/validation/DataBinder.java b/today-context/src/main/java/cn/taketoday/validation/DataBinder.java index 4988fb2067..d9fe24c035 100644 --- a/today-context/src/main/java/cn/taketoday/validation/DataBinder.java +++ b/today-context/src/main/java/cn/taketoday/validation/DataBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -694,7 +694,7 @@ private void assertValidators(Validator... validators) { Object target = getTarget(); for (Validator validator : validators) { if (validator != null && (target != null && !validator.supports(target.getClass()))) { - throw new IllegalStateException("Invalid target for Validator [" + validator + "]: " + target); + throw new IllegalStateException("Invalid target for Validator [%s]: %s".formatted(validator, target)); } } } diff --git a/today-context/src/main/java/cn/taketoday/validation/MapBindingResult.java b/today-context/src/main/java/cn/taketoday/validation/MapBindingResult.java index 54d768950f..87061acbf7 100644 --- a/today-context/src/main/java/cn/taketoday/validation/MapBindingResult.java +++ b/today-context/src/main/java/cn/taketoday/validation/MapBindingResult.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation; @@ -36,6 +33,7 @@ * Map, for example when invoking a Validator for a Map object. * * @author Juergen Hoeller + * @author Harry Yang * @see Map * @since 4.0 */ diff --git a/today-context/src/main/java/cn/taketoday/validation/ObjectError.java b/today-context/src/main/java/cn/taketoday/validation/ObjectError.java index a616e895ff..61e165130e 100644 --- a/today-context/src/main/java/cn/taketoday/validation/ObjectError.java +++ b/today-context/src/main/java/cn/taketoday/validation/ObjectError.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation; @@ -67,8 +64,7 @@ public ObjectError(String objectName, String defaultMessage) { * @param arguments the array of arguments to be used to resolve this message * @param defaultMessage the default message to be used to resolve this message */ - public ObjectError( - String objectName, @Nullable String[] codes, + public ObjectError(String objectName, @Nullable String[] codes, @Nullable Object[] arguments, @Nullable String defaultMessage) { super(codes, arguments, defaultMessage); diff --git a/today-context/src/main/java/cn/taketoday/validation/SimpleErrors.java b/today-context/src/main/java/cn/taketoday/validation/SimpleErrors.java index a577976367..933e50844f 100644 --- a/today-context/src/main/java/cn/taketoday/validation/SimpleErrors.java +++ b/today-context/src/main/java/cn/taketoday/validation/SimpleErrors.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation; @@ -144,8 +144,7 @@ public Object getFieldValue(String field) { return ReflectionUtils.getField(rawField, this.target); } - throw new IllegalArgumentException("Cannot retrieve value for field '" + field + - "' - neither a getter method nor a raw field found"); + throw new IllegalArgumentException("Cannot retrieve value for field '%s' - neither a getter method nor a raw field found".formatted(field)); } @Override diff --git a/today-context/src/main/java/cn/taketoday/validation/ValidationUtils.java b/today-context/src/main/java/cn/taketoday/validation/ValidationUtils.java index 30a72d3d90..68a3a08bf2 100644 --- a/today-context/src/main/java/cn/taketoday/validation/ValidationUtils.java +++ b/today-context/src/main/java/cn/taketoday/validation/ValidationUtils.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation; @@ -36,6 +33,7 @@ * * @author Juergen Hoeller * @author Dmitriy Kopylenko + * @author Harry Yang * @see Validator * @see Errors * @since 4.0 @@ -83,7 +81,7 @@ public static void invokeValidator(Validator validator, } if (!validator.supports(target.getClass())) { throw new IllegalArgumentException( - "Validator [" + validator.getClass() + "] does not support [" + target.getClass() + "]"); + "Validator [%s] does not support [%s]".formatted(validator.getClass(), target.getClass())); } if (ObjectUtils.isNotEmpty(validationHints) && validator instanceof SmartValidator) { @@ -256,9 +254,8 @@ public static void rejectIfEmptyOrWhitespace( * (can be {@code null}) * @param defaultMessage fallback default message */ - public static void rejectIfEmptyOrWhitespace( - Errors errors, String field, String errorCode, - @Nullable Object[] errorArgs, @Nullable String defaultMessage) { + public static void rejectIfEmptyOrWhitespace(Errors errors, String field, + String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage) { Assert.notNull(errors, "Errors object is required"); Object value = errors.getFieldValue(field); diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessor.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessor.java index 8abaf2e9af..7fda5dee04 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessor.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2023 the original author or authors. + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -97,8 +97,8 @@ public static BeanRegistrationAotContribution processAheadOfTime(RegisteredBean } catch (RuntimeException ex) { if (ex instanceof TypeNotPresentException) { - logger.debug("Skipping validation constraint hint inference for bean " + - registeredBean.getBeanName() + " due to a TypeNotPresentException at validator level: " + ex.getMessage()); + logger.debug("Skipping validation constraint hint inference for bean %s due to a TypeNotPresentException at validator level: %s" + .formatted(registeredBean.getBeanName(), ex.getMessage())); } else { logger.warn("Skipping validation constraint hint inference for bean " + diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationPostProcessor.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationPostProcessor.java index 323aec6583..7fbbad1c0c 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationPostProcessor.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/BeanValidationPostProcessor.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -41,7 +38,8 @@ * constraint violations right before calling the bean's init method (if any). * * @author Juergen Hoeller - * @since 4.0 + * @author Harry Yang + * @since 4.0s */ public class BeanValidationPostProcessor implements InitializationBeanPostProcessor, InitializingBean { diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/ContextConstraintValidatorFactory.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/ContextConstraintValidatorFactory.java index f1b689f68c..39affa9a0b 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/ContextConstraintValidatorFactory.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/ContextConstraintValidatorFactory.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -30,6 +27,7 @@ * Framework BeanFactory for creating autowired {@link ConstraintValidator} instances. * * @author Juergen Hoeller + * @author Harry Yang * @see AutowireCapableBeanFactory#createBean(Class) * @see cn.taketoday.context.ApplicationContext#getAutowireCapableBeanFactory() * @since 4.0 diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/CustomValidatorBean.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/CustomValidatorBean.java index 1b6555e8f7..c44f42a61b 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/CustomValidatorBean.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/CustomValidatorBean.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -35,6 +32,7 @@ * {@link cn.taketoday.validation.Validator} interface. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public class CustomValidatorBean extends InfraValidatorAdapter implements Validator, InitializingBean { diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/LocalValidatorFactoryBean.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/LocalValidatorFactoryBean.java index 97d6107a9b..62c4d7bfed 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/LocalValidatorFactoryBean.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/LocalValidatorFactoryBean.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © Harry Yang & 2017 - 2023 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -77,6 +74,7 @@ * {@code jakarta.validation} API being present but no explicit Validator having been configured. * * @author Juergen Hoeller + * @author Harry Yang * @see ValidatorFactory * @see Validator * @see Validation#buildDefaultValidatorFactory() diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/MessageSourceResourceBundleLocator.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/MessageSourceResourceBundleLocator.java index a13bf00b05..f43c76c4a5 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/MessageSourceResourceBundleLocator.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/MessageSourceResourceBundleLocator.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -34,6 +31,7 @@ * exposing a Framework {@link MessageSource} as localized {@link MessageSourceResourceBundle}. * * @author Juergen Hoeller + * @author Harry Yang * @see ResourceBundleLocator * @see MessageSource * @see MessageSourceResourceBundle diff --git a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/OptionalValidatorFactoryBean.java b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/OptionalValidatorFactoryBean.java index 45534380e4..23b02b293b 100644 --- a/today-context/src/main/java/cn/taketoday/validation/beanvalidation/OptionalValidatorFactoryBean.java +++ b/today-context/src/main/java/cn/taketoday/validation/beanvalidation/OptionalValidatorFactoryBean.java @@ -1,8 +1,5 @@ /* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER + * Copyright 2017 - 2024 the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] + * along with this program. If not, see [https://www.gnu.org/licenses/] */ package cn.taketoday.validation.beanvalidation; @@ -33,6 +30,7 @@ * Validator having been configured. * * @author Juergen Hoeller + * @author Harry Yang * @since 4.0 */ public class OptionalValidatorFactoryBean extends LocalValidatorFactoryBean {