You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2009/10/29 02:48:56 UTC

svn commit: r830825 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java

Author: ppoddar
Date: Thu Oct 29 01:48:55 2009
New Revision: 830825

URL: http://svn.apache.org/viewvc?rev=830825&view=rev
Log:
OPENJPA-1337: Push/Pop fetch plan with find()/refresh() 

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java?rev=830825&r1=830824&r2=830825&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java Thu Oct 29 01:48:55 2009
@@ -85,7 +85,6 @@
     /**
      * Gets a bean-style property name from the given key.
      * 
-     * 
      * @param key must begin with JPA property prefix <code>javax.persistence</code>
      * 
      * @return concatenates each part of the string leaving out <code>javax.persistence.</code> prefix. 
@@ -102,14 +101,6 @@
         return buf.toString();
     }
     
-    public static CacheRetrieveMode getCacheRetrieveMode(Map<String,Object> props) {
-        return getEnumValue(CacheRetrieveMode.class, CacheRetrieveMode.values(), CACHE_RETRIEVE_MODE, props);
-    }
-    
-    static CacheStoreMode getCacheStoreMode(Map<String,Object> props) {
-        return getEnumValue(CacheStoreMode.class, CacheStoreMode.values(), CACHE_STORE_MODE, props);
-    }
-    
     static <E extends Enum<E>> E get(Class<E> type, String key, Map<String,Object> prop) {
         return getEnumValue(type, null, key, prop);
     }
@@ -119,17 +110,18 @@
      * 
      * @return the same value if the given key is not a valid JPA property key or the value is null.
      */
-    public static Object convertValue(String key, Object value) {
+    public static <T> T  convertValue(Class<T> resultType, String key, Object value) {
         if (value == null)
             return null;
         if (JPAProperties.isValidKey(key)) {
+            // works because enum values are identical String
             if (value instanceof CacheRetrieveMode) {
-                return DataCacheRetrieveMode.valueOf(value.toString());
+                return (T)DataCacheRetrieveMode.valueOf(value.toString());
             } else if (value instanceof CacheStoreMode) {
-                return DataCacheStoreMode.valueOf(value.toString());
+                return (T)DataCacheStoreMode.valueOf(value.toString());
             }
         }
-        return value;
+        return (T)value;
     }