1 package test.dao; 2 3 8 public class ExampleDAOFactory { 9 10 11 private ExampleDAOFactory() { 12 } 13 14 public static Object getDaoInstance(Class clazz) { 15 if (clazz == null) { 16 throw new IllegalArgumentException ("No type supplied"); 17 } 18 19 if ("test.dao.CustomerDAO".equals(clazz.getName())) { 23 return new CustomerExampleDAO(); 24 } else { 25 throw new IllegalArgumentException ("Don't know how to create DAO of type " + clazz.getName()); 26 } 27 } 28 29 } 30 | Popular Tags |