From cb86d91ff00782f31ea664f030142d2a9a4bb674 Mon Sep 17 00:00:00 2001 From: mipo256 Date: Fri, 21 Feb 2025 09:29:27 +0300 Subject: [PATCH] Polishing. Uses new switch syntax. Signed-off-by: mipo256 Commit message changed by Jens Schauder Original pull request #2000 See #1998 --- .../support/JdbcQueryLookupStrategy.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java index fee40edb..bb828733 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java @@ -303,18 +303,13 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy { LOG.debug(String.format("Using the queryLookupStrategy %s", keyToUse)); - switch (keyToUse) { - case CREATE: - return createQueryLookupStrategy; - case USE_DECLARED_QUERY: - return declaredQueryLookupStrategy; - case CREATE_IF_NOT_FOUND: - return new CreateIfNotFoundQueryLookupStrategy(publisher, callbacks, context, converter, dialect, - queryMappingConfiguration, operations, createQueryLookupStrategy, declaredQueryLookupStrategy, - delegate); - default: - throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s", key)); - } + return switch (keyToUse) { + case CREATE -> createQueryLookupStrategy; + case USE_DECLARED_QUERY -> declaredQueryLookupStrategy; + case CREATE_IF_NOT_FOUND -> new CreateIfNotFoundQueryLookupStrategy( + publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations, + createQueryLookupStrategy, declaredQueryLookupStrategy, delegate); + }; } JdbcConverter getConverter() {