@@ -171,6 +171,8 @@ public final class PostgresqlConnectionFactoryProvider implements ConnectionFact
171171
172172 /**
173173 * Ssl mode alias (JDBC style). Default: disabled
174+ *
175+ * @since 0.8.13
174176 */
175177 public static final Option <SSLMode > SSL_MODE_ALIAS = Option .valueOf ("sslmode" );
176178
@@ -285,25 +287,8 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
285287 }
286288 });
287289
288- mapper .from (SSL_MODE ).map (it -> {
289-
290- if (it instanceof String ) {
291- return SSLMode .fromValue (it .toString ());
292- }
293-
294- return (SSLMode ) it ;
295-
296- }).to (builder ::sslMode ).otherwise (() -> {
297-
298- mapper .from (SSL_MODE_ALIAS ).map (it -> {
299-
300- if (it instanceof String ) {
301- return SSLMode .fromValue (it .toString ());
302- }
303-
304- return (SSLMode ) it ;
305-
306- }).to (builder ::sslMode );
290+ mapper .from (SSL_MODE ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode ).otherwise (() -> {
291+ mapper .from (SSL_MODE_ALIAS ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode );
307292 });
308293
309294 mapper .from (SSL_CERT ).to (builder ::sslCert );
@@ -330,6 +315,14 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
330315 }).to (builder ::sslHostnameVerifier );
331316 }
332317
318+ private static SSLMode toSSLMode (Object it ) {
319+ if (it instanceof String ) {
320+ return SSLMode .fromValue (it .toString ());
321+ }
322+
323+ return (SSLMode ) it ;
324+ }
325+
333326 @ SuppressWarnings ("unchecked" )
334327 private static Map <String , String > convertToMap (Object options ) {
335328 if (options instanceof Map ) {
0 commit comments