KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > discRack > spec > DiscFactory


1 /*
2  * discRack
3  *
4  * Enhydra super-servlet specification object
5  *
6  */

7 package discRack.spec;
8
9 public class DiscFactory {
10 /**
11 * Constructor can't be used.
12 */

13  private DiscFactory() {
14     }
15     /**
16      * Create a Disc as state object/value object/data transfer object
17      */

18     public static Disc getDisc(String JavaDoc fullClassName) throws DiscRackException
19     {
20         Disc result=null;
21         Class JavaDoc objectClass = null;
22         
23         try{
24          // Create the value object
25
objectClass = Class.forName(fullClassName);
26                                    
27           result = (Disc)objectClass.newInstance();
28         
29         
30          } catch (Exception JavaDoc ex) {
31             System.out.println("Error on creating the object" + ex);
32         }
33
34         return result;
35     
36   }
37   
38    }
Popular Tags