org.sql2o.tools.FeatureDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of anima Show documentation
Show all versions of anima Show documentation
Operate the database like a stream
package org.sql2o.tools;
/**
* Detects whether optional sql2o features are available.
*
* @author Alden Quimby
*/
public final class FeatureDetector {
private FeatureDetector() {}
static {
setCacheUnderscoreToCamelcaseEnabled(true); // enabled by default
}
private static Boolean oracleAvailable;
private static boolean cacheUnderscoreToCamelcaseEnabled;
/**
* @return {@code true} if oracle.sql is available, {@code false} otherwise.
*/
public static boolean isOracleAvailable() {
if (oracleAvailable == null) {
oracleAvailable = ClassUtils.isPresent("oracle.sql.TIMESTAMP");
}
return oracleAvailable;
}
/**
* @return {@code true} if caching of underscore to camelcase is enabled.
*/
public static boolean isCacheUnderscoreToCamelcaseEnabled() {
return cacheUnderscoreToCamelcaseEnabled;
}
/**
* Turn caching of underscore to camelcase on or off.
*/
public static void setCacheUnderscoreToCamelcaseEnabled(boolean cacheUnderscoreToCamelcaseEnabled) {
FeatureDetector.cacheUnderscoreToCamelcaseEnabled = cacheUnderscoreToCamelcaseEnabled;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy