Modernize code for diamond, isEmpty & pattern matching
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -37,6 +37,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
/**
|
||||
* @author David Turanski
|
||||
* @author Artem Bilan
|
||||
* @author Ngoc Nhan
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractScriptParser extends AbstractSingleBeanDefinitionParser {
|
||||
@@ -63,7 +64,7 @@ public abstract class AbstractScriptParser extends AbstractSingleBeanDefinitionP
|
||||
List<Element> variableElements = DomUtils.getChildElementsByTagName(element, "variable");
|
||||
String scriptVariableGeneratorName = element.getAttribute("script-variable-generator");
|
||||
|
||||
if (StringUtils.hasText(scriptVariableGeneratorName) && variableElements.size() > 0) {
|
||||
if (StringUtils.hasText(scriptVariableGeneratorName) && !variableElements.isEmpty()) {
|
||||
parserContext.getReaderContext().error(
|
||||
"'script-variable-generator' and 'variable' sub-elements are mutually exclusive.", element);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @author Ngoc Nhan
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ public abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
}
|
||||
|
||||
Bindings bindings = null;
|
||||
if (variables != null && variables.size() > 0) {
|
||||
if (variables != null && !variables.isEmpty()) {
|
||||
bindings = new SimpleBindings(variables);
|
||||
result = this.scriptEngine.eval(script, bindings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user