Avoid unnecessary boxing where primitives can be used
Closes gh-23267
This commit is contained in:
committed by
Sam Brannen
parent
2909de8829
commit
1728bf17fc
@@ -111,7 +111,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
CacheableOperation.Builder builder = prop.merge(opElement,
|
||||
parserContext.getReaderContext(), new CacheableOperation.Builder());
|
||||
builder.setUnless(getAttributeValue(opElement, "unless", ""));
|
||||
builder.setSync(Boolean.valueOf(getAttributeValue(opElement, "sync", "false")));
|
||||
builder.setSync(Boolean.parseBoolean(getAttributeValue(opElement, "sync", "false")));
|
||||
|
||||
Collection<CacheOperation> col = cacheOpMap.get(nameHolder);
|
||||
if (col == null) {
|
||||
@@ -132,12 +132,12 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String wide = opElement.getAttribute("all-entries");
|
||||
if (StringUtils.hasText(wide)) {
|
||||
builder.setCacheWide(Boolean.valueOf(wide.trim()));
|
||||
builder.setCacheWide(Boolean.parseBoolean(wide.trim()));
|
||||
}
|
||||
|
||||
String after = opElement.getAttribute("before-invocation");
|
||||
if (StringUtils.hasText(after)) {
|
||||
builder.setBeforeInvocation(Boolean.valueOf(after.trim()));
|
||||
builder.setBeforeInvocation(Boolean.parseBoolean(after.trim()));
|
||||
}
|
||||
|
||||
Collection<CacheOperation> col = cacheOpMap.get(nameHolder);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
|
||||
protected ClassPathBeanDefinitionScanner configureScanner(ParserContext parserContext, Element element) {
|
||||
boolean useDefaultFilters = true;
|
||||
if (element.hasAttribute(USE_DEFAULT_FILTERS_ATTRIBUTE)) {
|
||||
useDefaultFilters = Boolean.valueOf(element.getAttribute(USE_DEFAULT_FILTERS_ATTRIBUTE));
|
||||
useDefaultFilters = Boolean.parseBoolean(element.getAttribute(USE_DEFAULT_FILTERS_ATTRIBUTE));
|
||||
}
|
||||
|
||||
// Delegate bean definition registration to scanner class.
|
||||
@@ -145,7 +145,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
|
||||
// Register annotation config processors, if necessary.
|
||||
boolean annotationConfig = true;
|
||||
if (element.hasAttribute(ANNOTATION_CONFIG_ATTRIBUTE)) {
|
||||
annotationConfig = Boolean.valueOf(element.getAttribute(ANNOTATION_CONFIG_ATTRIBUTE));
|
||||
annotationConfig = Boolean.parseBoolean(element.getAttribute(ANNOTATION_CONFIG_ATTRIBUTE));
|
||||
}
|
||||
if (annotationConfig) {
|
||||
Set<BeanDefinitionHolder> processorDefinitions =
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParse
|
||||
if (StringUtils.hasText(exceptionHandler)) {
|
||||
builder.addPropertyReference("exceptionHandler", exceptionHandler);
|
||||
}
|
||||
if (Boolean.valueOf(element.getAttribute(AopNamespaceUtils.PROXY_TARGET_CLASS_ATTRIBUTE))) {
|
||||
if (Boolean.parseBoolean(element.getAttribute(AopNamespaceUtils.PROXY_TARGET_CLASS_ATTRIBUTE))) {
|
||||
builder.addPropertyValue("proxyTargetClass", true);
|
||||
}
|
||||
registerPostProcessor(parserContext, builder, TaskManagementConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
|
||||
|
||||
@@ -106,8 +106,8 @@ public class TaskExecutorFactoryBean implements
|
||||
int maxPoolSize;
|
||||
int separatorIndex = this.poolSize.indexOf('-');
|
||||
if (separatorIndex != -1) {
|
||||
corePoolSize = Integer.valueOf(this.poolSize.substring(0, separatorIndex));
|
||||
maxPoolSize = Integer.valueOf(this.poolSize.substring(separatorIndex + 1, this.poolSize.length()));
|
||||
corePoolSize = Integer.parseInt(this.poolSize.substring(0, separatorIndex));
|
||||
maxPoolSize = Integer.parseInt(this.poolSize.substring(separatorIndex + 1, this.poolSize.length()));
|
||||
if (corePoolSize > maxPoolSize) {
|
||||
throw new IllegalArgumentException(
|
||||
"Lower bound of pool-size range must not exceed the upper bound");
|
||||
|
||||
@@ -372,7 +372,7 @@ public class CronSequenceGenerator {
|
||||
return result;
|
||||
}
|
||||
if (!field.contains("-")) {
|
||||
result[0] = result[1] = Integer.valueOf(field);
|
||||
result[0] = result[1] = Integer.parseInt(field);
|
||||
}
|
||||
else {
|
||||
String[] split = StringUtils.delimitedListToStringArray(field, "-");
|
||||
@@ -380,8 +380,8 @@ public class CronSequenceGenerator {
|
||||
throw new IllegalArgumentException("Range has more than two fields: '" +
|
||||
field + "' in expression \"" + this.expression + "\"");
|
||||
}
|
||||
result[0] = Integer.valueOf(split[0]);
|
||||
result[1] = Integer.valueOf(split[1]);
|
||||
result[0] = Integer.parseInt(split[0]);
|
||||
result[1] = Integer.parseInt(split[1]);
|
||||
}
|
||||
if (result[0] >= max || result[1] >= max) {
|
||||
throw new IllegalArgumentException("Range exceeds maximum (" + max + "): '" +
|
||||
|
||||
@@ -426,7 +426,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
proxyTargetClass = (Boolean) attributeValue;
|
||||
}
|
||||
else if (attributeValue instanceof String) {
|
||||
proxyTargetClass = Boolean.valueOf((String) attributeValue);
|
||||
proxyTargetClass = Boolean.parseBoolean((String) attributeValue);
|
||||
}
|
||||
else if (attributeValue != null) {
|
||||
throw new BeanDefinitionStoreException("Invalid proxy target class attribute [" +
|
||||
|
||||
Reference in New Issue
Block a user