Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to StringBuilder.append(char) instead of StringBuilder.append(String) whenever we append a single character to a StringBuilder. Closes gh-27098
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -71,9 +71,9 @@ public class CacheEvictOperation extends CacheOperation {
|
||||
@Override
|
||||
protected StringBuilder getOperationDescription() {
|
||||
StringBuilder sb = super.getOperationDescription();
|
||||
sb.append(",");
|
||||
sb.append(',');
|
||||
sb.append(this.cacheWide);
|
||||
sb.append(",");
|
||||
sb.append(',');
|
||||
sb.append(this.beforeInvocation);
|
||||
return sb;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -216,13 +216,13 @@ public abstract class CacheOperation implements BasicOperation {
|
||||
*/
|
||||
protected StringBuilder getOperationDescription() {
|
||||
StringBuilder result = new StringBuilder(getClass().getSimpleName());
|
||||
result.append("[").append(this.name);
|
||||
result.append('[').append(this.name);
|
||||
result.append("] caches=").append(this.cacheNames);
|
||||
result.append(" | key='").append(this.key);
|
||||
result.append("' | keyGenerator='").append(this.keyGenerator);
|
||||
result.append("' | cacheManager='").append(this.cacheManager);
|
||||
result.append("' | cacheResolver='").append(this.cacheResolver);
|
||||
result.append("' | condition='").append(this.condition).append("'");
|
||||
result.append("' | condition='").append(this.condition).append('\'');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,7 @@ public class CachePutOperation extends CacheOperation {
|
||||
StringBuilder sb = super.getOperationDescription();
|
||||
sb.append(" | unless='");
|
||||
sb.append(this.unless);
|
||||
sb.append("'");
|
||||
sb.append('\'');
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,10 +79,10 @@ public class CacheableOperation extends CacheOperation {
|
||||
StringBuilder sb = super.getOperationDescription();
|
||||
sb.append(" | unless='");
|
||||
sb.append(this.unless);
|
||||
sb.append("'");
|
||||
sb.append('\'');
|
||||
sb.append(" | sync='");
|
||||
sb.append(this.sync);
|
||||
sb.append("'");
|
||||
sb.append('\'');
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
* @param message error message to append the HandlerMethod details to
|
||||
*/
|
||||
protected String getDetailedErrorMessage(Object bean, String message) {
|
||||
StringBuilder sb = new StringBuilder(message).append("\n");
|
||||
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.method.toGenericString()).append("]\n");
|
||||
@@ -426,7 +426,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
StringBuilder sb = new StringBuilder(getDetailedErrorMessage(bean, message));
|
||||
sb.append("Resolved arguments: \n");
|
||||
for (int i = 0; i < resolvedArgs.length; i++) {
|
||||
sb.append("[").append(i).append("] ");
|
||||
sb.append('[').append(i).append("] ");
|
||||
if (resolvedArgs[i] == null) {
|
||||
sb.append("[null] \n");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -205,12 +205,12 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
|
||||
}
|
||||
}
|
||||
result.append("]\n");
|
||||
result.append("}");
|
||||
result.append('}');
|
||||
if (it.hasNext()) {
|
||||
result.append(",\n");
|
||||
}
|
||||
}
|
||||
result.append("]");
|
||||
result.append(']');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user