1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.fulcrum.yaafi.interceptor.util;
21
22 /**
23 * Creates a string representation of java.lang.reflect.Method
24 *
25 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
26 */
27 public class DefaultToStringBuilderImpl implements InterceptorToStringBuilder
28 {
29 /** the target object */
30 private Object target;
31
32 /** the output for a NULL value **/
33 private static final String NULL_STRING = "<null>";
34
35 /**
36 * Constructor
37 */
38 public DefaultToStringBuilderImpl()
39 {
40
41 }
42
43 /**
44 * Constructor
45 *
46 * @param target the object to print
47 */
48 public DefaultToStringBuilderImpl(Object target)
49 {
50 this.target = target;
51 }
52
53 /**
54 * @see org.apache.fulcrum.yaafi.interceptor.util.InterceptorToStringBuilder#setTarget(java.lang.Object)
55 */
56 public void setTarget(Object target)
57 {
58 this.target = target;
59 }
60
61 /**
62 * @see org.apache.fulcrum.yaafi.interceptor.util.InterceptorToStringBuilder#setMaxArgLength(int)
63 */
64 public void setMaxArgLength(int maxArgLength)
65 {
66
67 }
68
69 /**
70 * @see org.apache.fulcrum.yaafi.interceptor.util.InterceptorToStringBuilder#setMode(int)
71 */
72 public void setMode(int mode)
73 {
74
75 }
76
77 /**
78 * @see java.lang.Object#toString()
79 */
80 public String toString()
81 {
82 String result = null;
83
84 try
85 {
86 if( this.target == null )
87 {
88 result = NULL_STRING;
89 }
90 else
91 {
92 result = this.target.toString();
93 }
94 }
95 catch (Throwable t)
96 {
97 t.printStackTrace();
98 result = "<" + t + ">";
99 }
100
101 return result;
102 }
103 }