You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/05/03 22:35:00 UTC

svn commit: r771123 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java

Author: doogie
Date: Sun May  3 20:35:00 2009
New Revision: 771123

URL: http://svn.apache.org/viewvc?rev=771123&view=rev
Log:
Make this a bit nicer for generics users.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java?rev=771123&r1=771122&r2=771123&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/Cache.java Sun May  3 20:35:00 2009
@@ -21,6 +21,7 @@
 import java.util.List;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.entity.GenericEntity;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.GenericPK;
@@ -62,16 +63,16 @@
         return entityListCache.get(entityName, condition, orderBy);
     }
 
-    public Object get(String entityName, EntityCondition condition, String name) {
-        return entityObjectCache.get(entityName, condition, name);
+    public <T> T get(String entityName, EntityCondition condition, String name) {
+        return UtilGenerics.<T>cast(entityObjectCache.get(entityName, condition, name));
     }
 
     public List<GenericValue> put(String entityName, EntityCondition condition, List<String> orderBy, List<GenericValue> entities) {
         return entityListCache.put(entityName, condition, orderBy, entities);
     }
 
-    public Object put(String entityName, EntityCondition condition, String name, Object value) {
-        return entityObjectCache.put(entityName, condition, name, value);
+    public <T> T put(String entityName, EntityCondition condition, String name, T value) {
+        return UtilGenerics.<T>cast(entityObjectCache.put(entityName, condition, name, value));
     }
 
     public GenericValue put(GenericValue entity) {
@@ -104,8 +105,8 @@
         entityObjectCache.remove(entityName, condition);
     }
 
-    public Object remove(String entityName, EntityCondition condition, String name) {
-        return entityObjectCache.remove(entityName, condition, name);
+    public <T> T remove(String entityName, EntityCondition condition, String name) {
+        return UtilGenerics.<T>cast(entityObjectCache.remove(entityName, condition, name));
     }
 
     public GenericValue remove(GenericEntity entity) {