package com.github.arteam.jdbi3;

import com.github.arteam.jdbi3.strategies.DelegatingStatementNameStrategy;
import com.github.arteam.jdbi3.strategies.NameStrategies;
import io.dropwizard.db.ManagedDataSource;
import io.dropwizard.db.PooledDataSourceFactory;
import io.dropwizard.setup.Environment;
import io.dropwizard.util.Duration;
import org.jdbi.v3.core.Jdbi;

import static com.codahale.metrics.MetricRegistry.name;

/**
 * @author Artem Prigoda
 * @since 28.07.16
 */
public class JdbiFactory {

    private static class SanerNamingStrategy extends DelegatingStatementNameStrategy {
        private SanerNamingStrategy() {
            super(NameStrategies.CHECK_EMPTY,
                    NameStrategies.CONTEXT_CLASS,
                    NameStrategies.CONTEXT_NAME,
                    NameStrategies.SQL_OBJECT,
                    statementContext -> name(Jdbi.class, "raw-sql"));
        }
    }

    public Jdbi build(Environment environment,
                      PooledDataSourceFactory configuration,
                      String name) {
        ManagedDataSource dataSource = configuration.build(environment.metrics(), name);
        String validationQuery = configuration.getValidationQuery();
        Jdbi jdbi = Jdbi.create(dataSource);
        jdbi.setTimingCollector(new InstrumentedTimingCollector(environment.metrics(), new SanerNamingStrategy()));
        jdbi.installPlugins();

        environment.lifecycle().manage(dataSource);
        environment.healthChecks().register(name, new JdbiHealthCheck(
                environment.getHealthCheckExecutorService(),
                configuration.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)),
                jdbi, validationQuery));

        return jdbi;
    }
}

@@ -160,16 +160,77 @@
 tegies;%0A
+import com.github.arteam.jdbi3.strategies.SmartNameStrategy;%0A
 import i
@@ -264,16 +264,16 @@
 Source;%0A
-
 import i
@@ -561,414 +561,8 @@
  %7B%0A%0A
-    private static class SanerNamingStrategy extends DelegatingStatementNameStrategy %7B%0A        private SanerNamingStrategy() %7B%0A            super(NameStrategies.CHECK_EMPTY,%0A                    NameStrategies.CONTEXT_CLASS,%0A                    NameStrategies.CONTEXT_NAME,%0A                    NameStrategies.SQL_OBJECT,%0A                    statementContext -%3E name(Jdbi.class, %22raw-sql%22));%0A        %7D%0A    %7D%0A%0A
     
@@ -1001,18 +1001,16 @@
 ew S
-anerNaming
+martName
 Stra

Use standard `SmartNameStrategy`