KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Created on May 18, 2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */

7 package org.enhydra.snapper.spec;
8
9 /**
10  * @author lola
11  *
12  * TODO To change the template for this generated type comment go to
13  * Window - Preferences - Java - Code Style - Code Templates
14  */

15 public class ConverterFactory {
16
17      /**
18      * Constructor can't be used.
19      */

20     private ConverterFactory() {
21     }
22
23     /**
24      * Create a Site as state object/value object/data transfer object
25      */

26     public static Converter createConverter(String JavaDoc fullClassName)throws Exception JavaDoc {
27         
28         Converter result = null;
29        
30         Class JavaDoc objectClass = null;
31
32         try {
33             // Create the value object
34

35       
36         objectClass = Class.forName(fullClassName);
37                                    
38           result = (Converter)objectClass.newInstance();
39                
40                        
41                     
42       } catch (Exception JavaDoc ex) {
43             System.out.println("Error on creating the object" + ex);
44         }
45
46         return result;
47     }
48     
49         
50     
51 }
52
Popular Tags