Remove unnecessary boxing/unboxing
This commit is contained in:
@@ -172,7 +172,7 @@ public abstract class AbstractStepParser {
|
||||
|
||||
String isAbstract = stepElement.getAttribute("abstract");
|
||||
if (StringUtils.hasText(isAbstract)) {
|
||||
bd.setAbstract(Boolean.valueOf(isAbstract));
|
||||
bd.setAbstract(Boolean.parseBoolean(isAbstract));
|
||||
}
|
||||
|
||||
String jobRepositoryRef = stepElement.getAttribute(JOB_REPO_ATTR);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -42,6 +42,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
* Internal parser for the <chunk/> element inside a step.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ChunkElementParser {
|
||||
@@ -141,7 +142,7 @@ public class ChunkElementParser {
|
||||
|
||||
if (!CollectionUtils.isEmpty(exceptionClassElements)) {
|
||||
skippableExceptions.setMergeEnabled(exceptionClassElements.get(0).hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(exceptionClassElements.get(0).getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(exceptionClassElements.get(0).getAttribute(MERGE_ATTR)));
|
||||
}
|
||||
// Even if there is no retryLimit, we can still accept exception
|
||||
// classes for an abstract parent bean definition
|
||||
@@ -167,7 +168,7 @@ public class ChunkElementParser {
|
||||
|
||||
if (!CollectionUtils.isEmpty(exceptionClassElements)) {
|
||||
retryableExceptions.setMergeEnabled(exceptionClassElements.get(0).hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(exceptionClassElements.get(0).getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(exceptionClassElements.get(0).getAttribute(MERGE_ATTR)));
|
||||
}
|
||||
// Even if there is no retryLimit, we can still accept exception
|
||||
// classes for an abstract parent bean definition
|
||||
@@ -296,7 +297,7 @@ public class ChunkElementParser {
|
||||
parserContext.pushContainingComponent(compositeDef);
|
||||
ManagedList<BeanMetadataElement> retryListenerBeans = new ManagedList<>();
|
||||
retryListenerBeans.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
handleRetryListenerElements(parserContext, listenersElement, retryListenerBeans, enclosing);
|
||||
propertyValues.addPropertyValue("retryListeners", retryListenerBeans);
|
||||
parserContext.popAndRegisterContainingComponent();
|
||||
@@ -319,7 +320,7 @@ public class ChunkElementParser {
|
||||
if (streamsElement != null) {
|
||||
ManagedList<RuntimeBeanReference> streamBeans = new ManagedList<>();
|
||||
streamBeans.setMergeEnabled(streamsElement.hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(streamsElement.getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(streamsElement.getAttribute(MERGE_ATTR)));
|
||||
List<Element> streamElements = DomUtils.getChildElementsByTagName(streamsElement, "stream");
|
||||
if (streamElements != null) {
|
||||
for (Element streamElement : streamElements) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -36,6 +36,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class CoreNamespaceUtils {
|
||||
|
||||
@@ -202,7 +203,7 @@ public class CoreNamespaceUtils {
|
||||
*/
|
||||
public static boolean isAbstract(Element element) {
|
||||
String abstractAttr = element.getAttribute("abstract");
|
||||
return StringUtils.hasText(abstractAttr) && Boolean.valueOf(abstractAttr);
|
||||
return StringUtils.hasText(abstractAttr) && Boolean.parseBoolean(abstractAttr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -36,6 +36,7 @@ import org.w3c.dom.Element;
|
||||
* definition for a {@link org.springframework.batch.core.Job}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
@@ -135,7 +136,7 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
parserContext.pushContainingComponent(compositeDef);
|
||||
ManagedList<BeanDefinition> listeners = new ManagedList<>();
|
||||
listeners.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
List<Element> listenerElements = DomUtils.getChildElementsByTagName(listenersElement, "listener");
|
||||
for (Element listenerElement : listenerElements) {
|
||||
listeners.add(jobListenerParser.parse(listenerElement, parserContext));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -34,6 +34,7 @@ import org.w3c.dom.Element;
|
||||
* attributes from the configuration.
|
||||
*
|
||||
* @author Dan Garrette
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
* @see AbstractListenerParser
|
||||
*/
|
||||
@@ -78,7 +79,7 @@ public class StepListenerParser extends AbstractListenerParser {
|
||||
listenerBeans = (ManagedList<BeanDefinition>) propertyValues.getPropertyValue("listeners").getValue();
|
||||
}
|
||||
listenerBeans.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(listenersElement.getAttribute(MERGE_ATTR)));
|
||||
List<Element> listenerElements = DomUtils.getChildElementsByTagName(listenersElement, "listener");
|
||||
if (listenerElements != null) {
|
||||
for (Element listenerElement : listenerElements) {
|
||||
|
||||
@@ -595,7 +595,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
|
||||
}
|
||||
|
||||
private boolean isTrue(Boolean b) {
|
||||
return b != null && b.booleanValue();
|
||||
return b != null && b;
|
||||
}
|
||||
|
||||
private boolean isPositive(Integer n) {
|
||||
|
||||
@@ -212,7 +212,7 @@ public class TaskletParser {
|
||||
Element exceptionClassesElement = children.get(0);
|
||||
ManagedList<TypedStringValue> list = new ManagedList<>();
|
||||
list.setMergeEnabled(exceptionClassesElement.hasAttribute(MERGE_ATTR)
|
||||
&& Boolean.valueOf(exceptionClassesElement.getAttribute(MERGE_ATTR)));
|
||||
&& Boolean.parseBoolean(exceptionClassesElement.getAttribute(MERGE_ATTR)));
|
||||
addExceptionClasses("include", exceptionClassesElement, list, parserContext);
|
||||
propertyValues.addPropertyValue(propertyName, list);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter {
|
||||
if (tokens.length <= 2) {
|
||||
return true;
|
||||
}
|
||||
return Boolean.valueOf(tokens[2]);
|
||||
return Boolean.parseBoolean(tokens[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class JsonJobParametersConverter extends DefaultJobParametersConverter {
|
||||
}
|
||||
boolean parameterIdentifying = true;
|
||||
if (jobParameterDefinition.identifying() != null && !jobParameterDefinition.identifying().isEmpty()) {
|
||||
parameterIdentifying = Boolean.valueOf(jobParameterDefinition.identifying());
|
||||
parameterIdentifying = Boolean.parseBoolean(jobParameterDefinition.identifying());
|
||||
}
|
||||
Object parameterTypedValue = this.conversionService.convert(jobParameterDefinition.value(), parameterType);
|
||||
return new JobParameter(parameterTypedValue, parameterType, parameterIdentifying);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.batch.core.ExitStatus;
|
||||
* @author Stijn Maller
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
|
||||
public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
|
||||
@@ -81,7 +82,7 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
|
||||
logger.fatal("Error mapping exit code, generic exit status returned.", ex);
|
||||
}
|
||||
|
||||
return (statusCode != null) ? statusCode.intValue() : JVM_EXITCODE_GENERIC_ERROR;
|
||||
return (statusCode != null) ? statusCode : JVM_EXITCODE_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
int currentVersion = getJdbcTemplate().queryForObject(getQuery(CURRENT_VERSION_JOB_EXECUTION), Integer.class,
|
||||
jobExecution.getId());
|
||||
|
||||
if (currentVersion != jobExecution.getVersion().intValue()) {
|
||||
if (currentVersion != jobExecution.getVersion()) {
|
||||
String status = getJdbcTemplate().queryForObject(getQuery(GET_STATUS), String.class, jobExecution.getId());
|
||||
jobExecution.upgradeStatus(BatchStatus.valueOf(status));
|
||||
jobExecution.setVersion(currentVersion);
|
||||
|
||||
Reference in New Issue
Block a user