From bdc35b5beebbd3c8f4249a97a60e2ffafe31ad3b Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 15 Sep 2009 05:54:58 +0000 Subject: [PATCH] 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 ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815044 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections/FactoryUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/commons/collections/FactoryUtils.java b/src/java/org/apache/commons/collections/FactoryUtils.java index 7cd869db8..85382f2fa 100644 --- a/src/java/org/apache/commons/collections/FactoryUtils.java +++ b/src/java/org/apache/commons/collections/FactoryUtils.java @@ -55,8 +55,8 @@ public class FactoryUtils { * * @return the factory */ - public static Factory exceptionFactory() { - return ExceptionFactory.INSTANCE; + public static Factory exceptionFactory() { + return ExceptionFactory.getInstance(); } /** @@ -64,11 +64,11 @@ public class FactoryUtils { * This could be useful during testing as a placeholder. * * @see org.apache.commons.collections.functors.ConstantFactory - * + * @param the "type" of null object the factory should return. * @return the factory */ - public static Factory nullFactory() { - return ConstantFactory.NULL_INSTANCE; + public static Factory nullFactory() { + return ConstantFactory.getInstance(null); } /** @@ -82,7 +82,7 @@ public class FactoryUtils { * @param constantToReturn the constant object to return each time in the factory * @return the constant factory. */ - public static Factory constantFactory(Object constantToReturn) { + public static Factory constantFactory(T constantToReturn) { return ConstantFactory.getInstance(constantToReturn); } @@ -103,8 +103,8 @@ public class FactoryUtils { * @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 Factory prototypeFactory(T prototype) { + return PrototypeFactory.getInstance(prototype); } /** @@ -117,7 +117,7 @@ public class FactoryUtils { * @return the reflection factory * @throws IllegalArgumentException if the classToInstantiate is null */ - public static Factory instantiateFactory(Class classToInstantiate) { + public static Factory instantiateFactory(Class classToInstantiate) { return InstantiateFactory.getInstance(classToInstantiate, null, null); } @@ -135,7 +135,7 @@ public class FactoryUtils { * @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 Factory instantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) { return InstantiateFactory.getInstance(classToInstantiate, paramTypes, args); }