KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > snapper > spec > DownloadFactory


1 /*
2  *
3  */

4 package org.enhydra.snapper.spec;
5
6
7 public class DownloadFactory {
8     
9     /**
10      * Constructor can't be used.
11      */

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

18     public static Download getDownload(String JavaDoc fullClassName)throws Exception JavaDoc {
19  
20         Download result = null;
21        
22         Class JavaDoc objectClass = null;
23
24         try {
25             // Create the value object
26

27          objectClass = Class.forName(fullClassName);
28   
29          result = (Download)objectClass.newInstance();
30                    
31       } catch (Exception JavaDoc ex) {
32             System.out.println("Error on creating the object: " + ex);
33         }
34
35         return result;
36     }
37     
38      
39     
40     
41     
42     
43     
44     
45 }
Popular Tags