Author: bayard
Date: Tue Sep 15 05:54:58 2009
New Revision: 815044

URL: http://svn.apache.org/viewvc?rev=815044&view=rev
Log:
Merging from -r468106:814127 of collections_jdk5_branch - namely where this 
code was generified; mostly in r738956.

Also see the following revisions:

    ------------------------------------------------------------------------
    r571381 | skestle | 2007-08-30 22:13:56 -0700 (Thu, 30 Aug 2007) | 1 line
    
    Generified LazyMap
    ------------------------------------------------------------------------
    r570378 | skestle | 2007-08-28 04:03:40 -0700 (Tue, 28 Aug 2007) | 1 line
    
    Generified InstantiateFactory
    ------------------------------------------------------------------------

Modified:
    
commons/proper/collections/trunk/src/java/org/apache/commons/collections/FactoryUtils.java

Modified: 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/FactoryUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/FactoryUtils.java?rev=815044&r1=815043&r2=815044&view=diff
==============================================================================
--- 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/FactoryUtils.java
 (original)
+++ 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/FactoryUtils.java
 Tue Sep 15 05:54:58 2009
@@ -55,8 +55,8 @@
      * 
      * @return the factory
      */
-    public static Factory exceptionFactory() {
-        return ExceptionFactory.INSTANCE;
+    public static <T> Factory<T> exceptionFactory() {
+        return ExceptionFactory.<T>getInstance();
     }
 
     /**
@@ -64,11 +64,11 @@
      * This could be useful during testing as a placeholder.
      *
      * @see org.apache.commons.collections.functors.ConstantFactory
-     * 
+     * @param <T> the "type" of null object the factory should return.
      * @return the factory
      */
-    public static Factory nullFactory() {
-        return ConstantFactory.NULL_INSTANCE;
+    public static <T> Factory<T> nullFactory() {
+        return ConstantFactory.<T>getInstance(null);
     }
 
     /**
@@ -82,7 +82,7 @@
      * @param constantToReturn  the constant object to return each time in the 
factory
      * @return the <code>constant</code> factory.
      */
-    public static Factory constantFactory(Object constantToReturn) {
+    public static <T> Factory<T> constantFactory(T constantToReturn) {
         return ConstantFactory.getInstance(constantToReturn);
     }
 
@@ -103,8 +103,8 @@
      * @throws IllegalArgumentException if the prototype is null
      * @throws IllegalArgumentException if the prototype cannot be cloned
      */
-    public static Factory prototypeFactory(Object prototype) {
-        return PrototypeFactory.getInstance(prototype);
+    public static <T> Factory<T> prototypeFactory(T  prototype) {
+        return PrototypeFactory.<T>getInstance(prototype);
     }
 
     /**
@@ -117,7 +117,7 @@
      * @return the <code>reflection</code> factory
      * @throws IllegalArgumentException if the classToInstantiate is null
      */
-    public static Factory instantiateFactory(Class classToInstantiate) {
+    public static <T> Factory<T> instantiateFactory(Class<T> 
classToInstantiate) {
         return InstantiateFactory.getInstance(classToInstantiate, null, null);
     }
 
@@ -135,7 +135,7 @@
      * @throws IllegalArgumentException if the paramTypes and args don't match
      * @throws IllegalArgumentException if the constructor doesn't exist
      */
-    public static Factory instantiateFactory(Class classToInstantiate, Class[] 
paramTypes, Object[] args) {
+    public static <T> Factory<T> instantiateFactory(Class<T> 
classToInstantiate, Class<?>[] paramTypes, Object[] args) {
         return InstantiateFactory.getInstance(classToInstantiate, paramTypes, 
args);
     }
 


Reply via email to