[seam-commits] Seam SVN: r9106 - trunk/src/main/org/jboss/seam/cache.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Sep 22 18:45:52 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-09-22 18:45:52 -0400 (Mon, 22 Sep 2008)
New Revision: 9106

Modified:
   trunk/src/main/org/jboss/seam/cache/CacheProvider.java
Log:
Add typesafe getters

Modified: trunk/src/main/org/jboss/seam/cache/CacheProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/cache/CacheProvider.java	2008-09-22 21:25:58 UTC (rev 9105)
+++ trunk/src/main/org/jboss/seam/cache/CacheProvider.java	2008-09-22 22:45:52 UTC (rev 9106)
@@ -62,6 +62,19 @@
    {
       return get(null, key);
    }
+   
+   /**
+    * Fetches an object for the given key from the cache and returns it if
+    * found. Only the default cache region will be searched.
+    * 
+    * @param key - a key to identify the object.
+    * @param type - the type of the object to return
+    * @return - the object if found or null if not
+    */
+   public <E> E get(String key, E type)
+   {
+      return (E) get(null, key);
+   }
 
    /**
     * Fetches an object for the given key from the cache and returns it if
@@ -72,6 +85,21 @@
     * @return - the object if found or null if not
     */
    public abstract Object get(String region, String key);
+   
+   /**
+    * Fetches an object for the given key from the cache and returns it if
+    * found. Only the specified cache region will be searched.
+    * 
+    * @param region - the name of a cache region
+    * @param key - a key to identify the object.
+    * @param type - the type of object to return
+    * 
+    * @return - the object if found or null if not
+    */
+   public <E> E get(String region, String key, E type)
+   {
+      return (E) get(region, key);
+   }
 
    /**
     * Put an object into the cache. The object is placed in the default cache




More information about the seam-commits mailing list