1 16 package org.apache.commons.collections; 17 18 import org.apache.commons.collections.functors.ConstantFactory; 19 import org.apache.commons.collections.functors.InstantiateFactory; 20 import org.apache.commons.collections.functors.ExceptionFactory; 21 import org.apache.commons.collections.functors.PrototypeFactory; 22 23 40 public class FactoryUtils { 41 42 45 public FactoryUtils() { 46 super(); 47 } 48 49 57 public static Factory exceptionFactory() { 58 return ExceptionFactory.INSTANCE; 59 } 60 61 69 public static Factory nullFactory() { 70 return ConstantFactory.NULL_INSTANCE; 71 } 72 73 84 public static Factory constantFactory(Object constantToReturn) { 85 return ConstantFactory.getInstance(constantToReturn); 86 } 87 88 105 public static Factory prototypeFactory(Object prototype) { 106 return PrototypeFactory.getInstance(prototype); 107 } 108 109 119 public static Factory instantiateFactory(Class classToInstantiate) { 120 return InstantiateFactory.getInstance(classToInstantiate, null, null); 121 } 122 123 137 public static Factory instantiateFactory(Class classToInstantiate, Class [] paramTypes, Object [] args) { 138 return InstantiateFactory.getInstance(classToInstantiate, paramTypes, args); 139 } 140 141 } 142 | Popular Tags |