Skip to content

Commit

Permalink
# IGNITE-329 Review.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Mar 10, 2015
1 parent 49fa33d commit d7a969b
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -34,8 +34,8 @@
*
* This implementation stores objects in underlying database using java beans mapping description via reflection.
*
* @param <K> the type of keys handled by this loader
* @param <V> the type of values generated by this loader
* @param <K> The type of keys handled by this loader.
* @param <V> The type of values generated by this loader.
*/
public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
/**
Expand All @@ -48,8 +48,8 @@ protected static class PojoMethodsCache {
/** Constructor for POJO object. */
private Constructor ctor;

/** Key have simple type. */
private final boolean simpleKey;
/** {@code true} if object is a simple type. */
private final boolean simple;

/** Cached setters for POJO object. */
private Map<String, Method> getters;
Expand All @@ -67,7 +67,8 @@ public PojoMethodsCache(String clsName, Collection<CacheTypeFieldMetadata> field
try {
cls = Class.forName(clsName);

if (simpleKey = (Number.class.isAssignableFrom(cls) || cls.isInstance(String.class)))
if (simple = (Number.class.isAssignableFrom(cls) || String.class.isAssignableFrom(cls) ||
java.util.Date.class.isAssignableFrom(cls)) || Boolean.class.isAssignableFrom(cls))
return;

ctor = cls.getDeclaredConstructor();
Expand Down Expand Up @@ -156,7 +157,7 @@ public PojoMethodsCache(String clsName, Collection<CacheTypeFieldMetadata> field
throw new CacheLoaderException("Failed to find cache type metadata for type: " + typeName);

try {
if (mc.simpleKey) {
if (mc.simple) {
CacheTypeFieldMetadata field = F.first(fields);

return (R)getColumnValue(rs, loadColIdxs.get(field.getDatabaseName()), mc.cls);
Expand Down Expand Up @@ -195,7 +196,7 @@ public PojoMethodsCache(String clsName, Collection<CacheTypeFieldMetadata> field
if (mc == null)
throw new CacheException("Failed to find cache type metadata for type: " + typeName);

if (mc.simpleKey)
if (mc.simple)
return obj;

Method getter = mc.getters.get(fieldName);
Expand Down

0 comments on commit d7a969b

Please sign in to comment.