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