com.undefinedlabs.scope.rules.sql.provider.PreparedStatementQueryProviderRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scope-rule-java-sql Show documentation
Show all versions of scope-rule-java-sql Show documentation
Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly identify, troubleshoot and fix failed builds.
This artifact contains the classes to instrument the Java SQL package.
package com.undefinedlabs.scope.rules.sql.provider;
import com.undefinedlabs.scope.rules.sql.provider.internal.NoopPreparedStatementQueryProvider;
import com.undefinedlabs.scope.rules.sql.provider.internal.h2.JdbcPreparedStatementQueryProvider;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
public enum PreparedStatementQueryProviderRegistry {
INSTANCE;
private static final PreparedStatementQueryProvider NOOP_PROVIDER = new NoopPreparedStatementQueryProvider();
private static final Map PROVIDERS = new HashMap<>();
static {
PROVIDERS.put(JdbcPreparedStatementQueryProvider.JDBC_PREPARED_STATEMENT_CLASS_NAME, new JdbcPreparedStatementQueryProvider());
}
public PreparedStatementQueryProvider getProvider(final PreparedStatement preparedStatement) {
return preparedStatement != null ? getProvider(preparedStatement.getClass().getName()) : NOOP_PROVIDER;
}
PreparedStatementQueryProvider getProvider(final String preparedStatementClassName) {
return PROVIDERS.get(preparedStatementClassName) != null ? PROVIDERS.get(preparedStatementClassName) : NOOP_PROVIDER;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy