Browse Source

Polish "Replace if with switch where feasible"

See gh-31916
pull/31920/head
Stéphane Nicoll 2 years ago
parent
commit
3c5d46166e
  1. 5
      spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java
  2. 2
      spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java
  3. 9
      spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java
  4. 2
      spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java
  5. 2
      spring-web/src/main/java/org/springframework/web/util/TagUtils.java

5
spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-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.
@ -186,8 +186,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser { @@ -186,8 +186,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
case "targetClass" -> scanner.setScopedProxyMode(ScopedProxyMode.TARGET_CLASS);
case "interfaces" -> scanner.setScopedProxyMode(ScopedProxyMode.INTERFACES);
case "no" -> scanner.setScopedProxyMode(ScopedProxyMode.NO);
default ->
throw new IllegalArgumentException("scoped-proxy only supports 'no', 'interfaces' and 'targetClass'");
default -> throw new IllegalArgumentException("scoped-proxy only supports 'no', 'interfaces' and 'targetClass'");
}
}
}

2
spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.

9
spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java

@ -246,13 +246,10 @@ public abstract class JdbcUtils { @@ -246,13 +246,10 @@ public abstract class JdbcUtils {
case "LocalDate" -> rs.getDate(index);
case "LocalTime" -> rs.getTime(index);
case "LocalDateTime" -> rs.getTimestamp(index);
default ->
// Fall back to getObject without type specification, again
// left up to the caller to convert the value if necessary.
getResultSetValue(rs, index);
// Fall back to getObject without type specification, again
// left up to the caller to convert the value if necessary.
default -> getResultSetValue(rs, index);
};
}
// Perform was-null check if necessary (for results that the JDBC driver returns as primitives).

2
spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-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.

2
spring-web/src/main/java/org/springframework/web/util/TagUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-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.

Loading…
Cancel
Save