Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref #81 - removed possibility to cache POJO metadata. #85

Merged
merged 1 commit into from Apr 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions core/src/main/java/org/sql2o/DefaultResultSetHandlerFactory.java
Expand Up @@ -126,15 +126,12 @@ protected ResultSetHandler evaluate(Key key, ResultSetMetaData param) {

@SuppressWarnings("unchecked")
public ResultSetHandler<T> newResultSetHandler(final ResultSetMetaData meta) throws SQLException {
if(FeatureDetector.isCachePojoMetaDataEnabled()){
StringBuilder stringBuilder = new StringBuilder();
for (int i = 1; i <= meta.getColumnCount(); i++) {
stringBuilder.append(quirks.getColumnName(meta,i)).append("\n");
}
return c.get(new Key(stringBuilder.toString(), this),meta);
} else {
return newResultSetHandler0(meta);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 1; i <= meta.getColumnCount(); i++) {
stringBuilder.append(quirks.getColumnName(meta,i)).append("\n");
}
return c.get(new Key(stringBuilder.toString(), this),meta);

}


Expand Down
7 changes: 2 additions & 5 deletions core/src/main/java/org/sql2o/reflection/PojoMetadata.java
Expand Up @@ -63,11 +63,8 @@ public PojoMetadata(Class clazz, boolean caseSensitive, boolean autoDeriveColumn
this.clazz = clazz;
this.columnMappings = columnMappings == null ? Collections.<String,String>emptyMap() : columnMappings;

if (FeatureDetector.isCachePojoMetaDataEnabled()) {
this.propertyInfo = getPropertyInfoThroughCache();
} else {
this.propertyInfo = initializePropertyInfo();
}
this.propertyInfo = getPropertyInfoThroughCache();

}

public ObjectConstructor getObjectConstructor() {
Expand Down
15 changes: 0 additions & 15 deletions core/src/main/java/org/sql2o/tools/FeatureDetector.java
Expand Up @@ -11,7 +11,6 @@ private FeatureDetector()
{}

static {
cachePojoMetaDataEnabled(true); // enabled by default
setCacheUnderscoreToCamelcaseEnabled(true); // enabled by default
}

Expand Down Expand Up @@ -51,20 +50,6 @@ public static boolean isOracleAvailable() {
return oracleAvailable;
}

/**
* @return {@code true} if class metadata caching is enabled, {@code false} otherwise.
*/
public static boolean isCachePojoMetaDataEnabled() {
return cachePojoMetaDataEnabled;
}

/**
* Turn class metadata caching on or off.
*/
public static void cachePojoMetaDataEnabled(boolean b) {
cachePojoMetaDataEnabled = b;
}

/**
*
* @return {@code true} if caching of underscore to camelcase is enabled.
Expand Down