KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tableappclient > spec > AccessDataFactory


1 package tableappclient.spec;
2
3 /**
4  * <p>Title: </p>
5  * <p>Description: </p>
6  * <p>Copyright: Copyright (c) 2005</p>
7  * <p>Company: </p>
8  * @author not attributable
9  * @version 1.0
10  */

11
12 public class AccessDataFactory {
13   private AccessDataFactory() {};
14   public static AccessData createAccessData(String JavaDoc fullClassName, String JavaDoc hostName, String JavaDoc portNum) {
15     AccessData result = null;
16     Class JavaDoc objectClass = null;
17     try {
18 // Create the value object
19
Class JavaDoc [] 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 JavaDoc[] {new String JavaDoc(hostName), new String JavaDoc(portNum)});
22     }
23     catch (Exception JavaDoc ex) {
24       System.err.println("Error on creating the object" + ex);
25     }
26     return result;
27   }
28
29 }
Popular Tags