01: /**
02: * Title: EJOSA - Enterprise Java Open Source Architecture
03: * My Piggy Bank Example
04: * Description: Specification Object
05: * Copyright: Copyright (c) 2003 by B. Lofi Dewanto, T. Menzel
06: * Company: University of Muenster, HTWK Leipzig
07: * @author B. Lofi Dewanto, T. Menzel
08: * @version 1.2
09: */package net.sourceforge.ejosa.piggybank.spec.business;
10:
11: /**
12: * The business object factory.
13: *
14: * @author B. Lofi Dewanto, T. Menzel
15: * @version 1.2
16: */
17: public class CoinFactory {
18: /**
19: * Constructor can't be used.
20: */
21: private CoinFactory() {
22: }
23:
24: /**
25: * Create a coin as state object/value object/data transfer object
26: */
27: public static Coin createCoin(String fullClassName) {
28: Coin result = null;
29: Class objectClass = null;
30:
31: try {
32: // Create the value object
33: objectClass = Class.forName(fullClassName);
34: result = (Coin) objectClass.newInstance();
35: } catch (Exception ex) {
36: System.out.println("Error on creating the object" + ex);
37: }
38:
39: return result;
40: }
41: }
|