01: /**
02: * Title: OpenUSS - Open Source University Support System
03: * Description: Utility for OpenUSS
04: * Copyright: Copyright (c) B. Lofi Dewanto
05: * Company: University of Muenster
06: * @author B. Lofi Dewanto
07: * @version 1.0
08: */package org.openuss.utility;
09:
10: import java.util.*;
11:
12: /**
13: * Utility for classes.
14: *
15: * @author B. Lofi Dewanto
16: * @version 1.0
17: */
18: public class ClassUtility {
19: /**
20: * Create an object from the classname and its package.
21: */
22: public static Object createClass(String policyName,
23: String packageName) throws Exception {
24: // Put the package name
25: String className = policyName;
26: String fullClassName = packageName.concat(".")
27: .concat(className);
28:
29: Class objectClass = null;
30: Object result = null;
31:
32: // Create the policy
33: objectClass = Class.forName(fullClassName);
34: result = objectClass.newInstance();
35:
36: // Result
37: return result;
38: }
39: }
|