1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.mchaplin.commons;
22
23 import net.mchaplin.commons.i18n.PropertyResourceHelperI;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 /***
29 * Utility object. Provide variables declarations
30 * for various resources as well as handful
31 * methods
32 *
33 * @author mchaplin@users.sourceforge.net
34 *
35 * $Header:
36 * $Revision:
37 * $Date:
38 */
39 public class WmindObject {
40
41 protected transient PropertyResourceHelperI propertyHelper = null;
42 protected static final String METHOD_CALL = "Method Call : ";
43 protected static final String STACK_PREFIX = "\t at ";
44
45 /***
46 * log reference
47 */
48 protected static Log log = null;
49 public static final String EX_STACK = "\n Full Stack : ";
50 public static final String EX_CAUSE = "\n Cause : ";
51
52 public WmindObject() {
53 log = LogFactory.getLog(this.getClass());
54 log.debug("Instanciating : ["+this.getClass().getName()+"]");
55 }
56
57 /***
58 * Return a formatted String enumerating
59 * interfaces & classes inheritance
60 * for this object.
61 *
62 * @param oFactory the object to introspect
63 */
64 protected String printInheritance(Object oFactory) {
65
66 Class[] curClassEnum = null;
67 Class curClass = null;
68
69 String sFactoryType = oFactory.toString().substring(6);
70
71 curClassEnum = oFactory.getClass().getInterfaces();
72 StringBuffer sb = new StringBuffer("Object "+sFactoryType+" implements interfaces : [");
73 for (int i=0 ; i<curClassEnum.length ; i++) {
74 curClass = curClassEnum[i];
75 sb.append(curClass.getName()).append(", ");
76 }
77 sb.delete(sb.length()-2, sb.length()).append("]");
78 curClassEnum = oFactory.getClass().getDeclaredClasses();
79 sb.append(", extends : [");
80 for (int i=0 ; i<curClassEnum.length ; i++) {
81 curClass = curClassEnum[i];
82 sb.append(curClass.getName()).append(", ");
83 }
84 sb.delete(sb.length()-2, sb.length()).append("]");
85
86
87
88
89
90
91
92
93
94
95 return sb.toString();
96 }
97 }