Skip to content

Commit

Permalink
🎨 字符串 拼接 使用 formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
TAKETODAY committed Apr 12, 2024
1 parent 1fe50ae commit cecb456
Show file tree
Hide file tree
Showing 127 changed files with 446 additions and 745 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand Down Expand Up @@ -47,6 +44,7 @@
* @author Costin Leau
* @author Juergen Hoeller
* @author Stephane Nicoll
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
@SuppressWarnings("serial")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -38,6 +35,7 @@
*
* @author Chris Beams
* @author Stephane Nicoll
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @see EnableCaching
* @see ProxyCachingConfiguration
* @since 4.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand Down Expand Up @@ -47,6 +44,7 @@
* @author Phillip Webb
* @author Stephane Nicoll
* @author Sam Brannen
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
@SuppressWarnings("serial")
Expand Down Expand Up @@ -94,7 +92,7 @@ private Collection<CacheOperation> parseCacheAnnotations(

Collection<? extends Annotation> 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;
}
Expand Down Expand Up @@ -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.");
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -40,6 +37,7 @@
*
* @author Costin Leau
* @author Juergen Hoeller
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public class ConcurrentMapCacheFactoryBean
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand Down Expand Up @@ -55,6 +52,7 @@
*
* @author Costin Leau
* @author Stephane Nicoll
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand Down Expand Up @@ -51,6 +48,7 @@
* @author Costin Leau
* @author Phillip Webb
* @author Stephane Nicoll
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
*/
class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -24,6 +21,7 @@
* Configuration constants for internal sharing across subpackages.
*
* @author Juergen Hoeller
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public abstract class CacheManagementConfigUtils {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -35,6 +32,7 @@
* Framework cache management facilities.
*
* @author Costin Leau
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public class CacheNamespaceHandler extends NamespaceHandlerSupport {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -30,6 +27,7 @@
*
* @author Stephane Nicoll
* @author Juergen Hoeller
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @see CacheErrorHandler
* @since 4.0
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -37,6 +34,7 @@
*
* @author Stephane Nicoll
* @author Juergen Hoeller
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public abstract class AbstractCacheResolver implements CacheResolver, InitializingBean {
Expand Down Expand Up @@ -92,8 +90,7 @@ public Collection<? extends Cache> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Cl
* is not cacheable
*/
@Nullable
private Collection<CacheOperation> getCacheOperations(
Method method, @Nullable Class<?> targetClass, boolean cacheNull) {

private Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass, boolean cacheNull) {
if (ReflectionUtils.isObjectMethod(method)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang ([email protected]) 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
Expand All @@ -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;
Expand All @@ -31,6 +28,7 @@
* cache advice bean for methods that are cacheable.
*
* @author Costin Leau
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public class BeanFactoryCacheOperationSourceAdvisor extends AbstractBeanFactoryPointcutAdvisor {
Expand Down
Loading

0 comments on commit cecb456

Please sign in to comment.