Avoid unnecessary boxing where primitives can be used
Closes gh-23267
This commit is contained in:
parent
2909de8829
commit
1728bf17fc
|
|
@ -45,7 +45,7 @@ class ScopedProxyBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
|||
if (node instanceof Element) {
|
||||
Element ele = (Element) node;
|
||||
if (ele.hasAttribute(PROXY_TARGET_CLASS)) {
|
||||
proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
|
||||
proxyTargetClass = Boolean.parseBoolean(ele.getAttribute(PROXY_TARGET_CLASS));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
|
|||
return true;
|
||||
}
|
||||
Object value = beanDefinition.getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE);
|
||||
return (value != null && (Boolean.TRUE.equals(value) || Boolean.valueOf(value.toString())));
|
||||
return (value != null && (Boolean.TRUE.equals(value) || Boolean.parseBoolean(value.toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 [" +
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
|||
if (rawValues == null) {
|
||||
return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
|
||||
}
|
||||
return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
|
||||
return new long[] {Long.parseLong(rawValues[0]), Long.parseLong(rawValues[1])};
|
||||
}
|
||||
|
||||
public void setAcceptVersion(String acceptVersion) {
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
|
|||
if (rawValues == null) {
|
||||
return null;
|
||||
}
|
||||
return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
|
||||
return new long[] {Long.parseLong(rawValues[0]), Long.parseLong(rawValues[1])};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ final class PersistenceUnitReader {
|
|||
Element excludeUnlistedClasses = DomUtils.getChildElementByTagName(persistenceUnit, EXCLUDE_UNLISTED_CLASSES);
|
||||
if (excludeUnlistedClasses != null) {
|
||||
String excludeText = DomUtils.getTextValue(excludeUnlistedClasses);
|
||||
unitInfo.setExcludeUnlistedClasses(!StringUtils.hasText(excludeText) || Boolean.valueOf(excludeText));
|
||||
unitInfo.setExcludeUnlistedClasses(!StringUtils.hasText(excludeText) || Boolean.parseBoolean(excludeText));
|
||||
}
|
||||
|
||||
// set JPA 2.0 shared cache mode
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||
}
|
||||
}
|
||||
if (StringUtils.hasText(readOnly)) {
|
||||
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
|
||||
attribute.setReadOnly(Boolean.parseBoolean(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
|
||||
}
|
||||
|
||||
List<RollbackRuleAttribute> rollbackRules = new LinkedList<>();
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
|
|||
sseBuilder.event(line.substring(6).trim());
|
||||
}
|
||||
else if (line.startsWith("retry:")) {
|
||||
sseBuilder.retry(Duration.ofMillis(Long.valueOf(line.substring(6).trim())));
|
||||
sseBuilder.retry(Duration.ofMillis(Long.parseLong(line.substring(6).trim())));
|
||||
}
|
||||
else if (line.startsWith(":")) {
|
||||
comment = (comment != null ? comment : new StringBuilder());
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
|||
}
|
||||
}
|
||||
|
||||
if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
|
||||
if (convertersElement == null || Boolean.parseBoolean(convertersElement.getAttribute("register-defaults"))) {
|
||||
messageConverters.setSource(source);
|
||||
messageConverters.add(createConverterDefinition(ByteArrayHttpMessageConverter.class, source));
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class HandlersBeanDefinitionParser implements BeanDefinitionParser {
|
|||
context.pushContainingComponent(compDefinition);
|
||||
|
||||
String orderAttribute = element.getAttribute("order");
|
||||
int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.valueOf(orderAttribute);
|
||||
int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.parseInt(orderAttribute);
|
||||
|
||||
RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class);
|
||||
handlerMappingDef.setSource(source);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|||
RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class);
|
||||
|
||||
String orderAttribute = element.getAttribute("order");
|
||||
int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.valueOf(orderAttribute);
|
||||
int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.parseInt(orderAttribute);
|
||||
handlerMappingDef.getPropertyValues().add("order", order);
|
||||
|
||||
String pathHelper = element.getAttribute("path-helper");
|
||||
|
|
@ -485,7 +485,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|||
converters.add(object);
|
||||
}
|
||||
}
|
||||
if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
|
||||
if (convertersElement == null || Boolean.parseBoolean(convertersElement.getAttribute("register-defaults"))) {
|
||||
converters.setSource(source);
|
||||
converters.add(new RootBeanDefinition(StringMessageConverter.class));
|
||||
converters.add(new RootBeanDefinition(ByteArrayMessageConverter.class));
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ public abstract class AbstractClientSockJsSession implements WebSocketSession {
|
|||
if (frameData != null) {
|
||||
String[] data = getMessageCodec().decode(frameData);
|
||||
if (data != null && data.length == 2) {
|
||||
closeStatus = new CloseStatus(Integer.valueOf(data[0]), data[1]);
|
||||
closeStatus = new CloseStatus(Integer.parseInt(data[0]), data[1]);
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Processing SockJS close frame with " + closeStatus + " in " + this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue