1 7 package phoneList.spec; 8 9 10 public class PhoneListFactory { 11 12 15 private PhoneListFactory() { 16 } 17 18 21 public static PhoneList getPhoneList(String fullClassName) { 22 23 PhoneList result = null; 24 25 Class objectClass = null; 26 27 try { 28 30 31 objectClass = Class.forName(fullClassName); 32 33 result = (PhoneList)objectClass.newInstance(); 34 35 36 37 } catch (Exception ex) { 38 System.out.println("Error on creating the object" + ex); 39 } 40 41 return result; 42 } 43 } | Popular Tags |