01: /*
02: * chat
03: *
04: * Enhydra super-servlet specification object
05: *
06: */
07: package chat.spec;
08:
09: public class MessageFactory {
10:
11: /**
12: * Constructor can't be used.
13: */
14: private MessageFactory() {
15: }
16:
17: /**
18: * Create a Mesage as state object/value object/data transfer object
19: */
20: public static Message getMessage(String fullClassName) {
21:
22: Message result = null;
23:
24: Class objectClass = null;
25:
26: try {
27: // Create the value object
28:
29: objectClass = Class.forName(fullClassName);
30:
31: result = (Message) objectClass.newInstance();
32:
33: } catch (Exception ex) {
34: System.out.println("Error on creating the object" + ex);
35: }
36:
37: return result;
38: }
39: }
|