1 package tableappclient.spec; 2 3 11 12 public class AccessDataFactory { 13 private AccessDataFactory() {}; 14 public static AccessData createAccessData(String fullClassName, String hostName, String portNum) { 15 AccessData result = null; 16 Class objectClass = null; 17 try { 18 Class [] temp = {Class.forName("java.lang.String"),Class.forName("java.lang.String")}; 20 objectClass = Class.forName(fullClassName); 21 result = (AccessData) objectClass.getConstructor(temp).newInstance(new Object [] {new String (hostName), new String (portNum)}); 22 } 23 catch (Exception ex) { 24 System.err.println("Error on creating the object" + ex); 25 } 26 return result; 27 } 28 29 } | Popular Tags |