1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.lang3.builder;
18
19 import java.io.Serializable;
20 import java.lang.reflect.Array;
21 import java.util.Collection;
22 import java.util.Map;
23 import java.util.Map.Entry;
24 import java.util.Objects;
25 import java.util.WeakHashMap;
26
27 import org.apache.commons.lang3.ClassUtils;
28 import org.apache.commons.lang3.ObjectUtils;
29 import org.apache.commons.lang3.StringEscapeUtils;
30 import org.apache.commons.lang3.StringUtils;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 @SuppressWarnings("deprecation")
69 public abstract class ToStringStyle implements Serializable {
70
71
72
73
74
75
76
77 private static final class DefaultToStringStyle extends ToStringStyle {
78
79
80
81
82
83
84 private static final long serialVersionUID = 1L;
85
86
87
88
89
90
91 DefaultToStringStyle() {
92 }
93
94
95
96
97
98
99 private Object readResolve() {
100 return DEFAULT_STYLE;
101 }
102
103 }
104
105
106
107
108
109
110
111
112
113
114
115
116 private static final class JsonToStringStyle extends ToStringStyle {
117
118 private static final long serialVersionUID = 1L;
119
120 private static final String FIELD_NAME_QUOTE = "\"";
121
122
123
124
125
126
127
128
129 JsonToStringStyle() {
130 this.setUseClassName(false);
131 this.setUseIdentityHashCode(false);
132
133 this.setContentStart("{");
134 this.setContentEnd("}");
135
136 this.setArrayStart("[");
137 this.setArrayEnd("]");
138
139 this.setFieldSeparator(",");
140 this.setFieldNameValueSeparator(":");
141
142 this.setNullText("null");
143
144 this.setSummaryObjectStartText("\"<");
145 this.setSummaryObjectEndText(">\"");
146
147 this.setSizeStartText("\"<size=");
148 this.setSizeEndText(">\"");
149 }
150
151 @Override
152 public void append(final StringBuffer buffer, final String fieldName,
153 final boolean[] array, final Boolean fullDetail) {
154
155 if (fieldName == null) {
156 throw new UnsupportedOperationException(
157 "Field names are mandatory when using JsonToStringStyle");
158 }
159 if (!isFullDetail(fullDetail)) {
160 throw new UnsupportedOperationException(
161 "FullDetail must be true when using JsonToStringStyle");
162 }
163
164 super.append(buffer, fieldName, array, fullDetail);
165 }
166
167 @Override
168 public void append(final StringBuffer buffer, final String fieldName, final byte[] array,
169 final Boolean fullDetail) {
170
171 if (fieldName == null) {
172 throw new UnsupportedOperationException(
173 "Field names are mandatory when using JsonToStringStyle");
174 }
175 if (!isFullDetail(fullDetail)) {
176 throw new UnsupportedOperationException(
177 "FullDetail must be true when using JsonToStringStyle");
178 }
179
180 super.append(buffer, fieldName, array, fullDetail);
181 }
182
183 @Override
184 public void append(final StringBuffer buffer, final String fieldName, final char[] array,
185 final Boolean fullDetail) {
186
187 if (fieldName == null) {
188 throw new UnsupportedOperationException(
189 "Field names are mandatory when using JsonToStringStyle");
190 }
191 if (!isFullDetail(fullDetail)) {
192 throw new UnsupportedOperationException(
193 "FullDetail must be true when using JsonToStringStyle");
194 }
195
196 super.append(buffer, fieldName, array, fullDetail);
197 }
198
199 @Override
200 public void append(final StringBuffer buffer, final String fieldName,
201 final double[] array, final Boolean fullDetail) {
202
203 if (fieldName == null) {
204 throw new UnsupportedOperationException(
205 "Field names are mandatory when using JsonToStringStyle");
206 }
207 if (!isFullDetail(fullDetail)) {
208 throw new UnsupportedOperationException(
209 "FullDetail must be true when using JsonToStringStyle");
210 }
211
212 super.append(buffer, fieldName, array, fullDetail);
213 }
214
215 @Override
216 public void append(final StringBuffer buffer, final String fieldName,
217 final float[] array, final Boolean fullDetail) {
218
219 if (fieldName == null) {
220 throw new UnsupportedOperationException(
221 "Field names are mandatory when using JsonToStringStyle");
222 }
223 if (!isFullDetail(fullDetail)) {
224 throw new UnsupportedOperationException(
225 "FullDetail must be true when using JsonToStringStyle");
226 }
227
228 super.append(buffer, fieldName, array, fullDetail);
229 }
230
231 @Override
232 public void append(final StringBuffer buffer, final String fieldName, final int[] array,
233 final Boolean fullDetail) {
234
235 if (fieldName == null) {
236 throw new UnsupportedOperationException(
237 "Field names are mandatory when using JsonToStringStyle");
238 }
239 if (!isFullDetail(fullDetail)) {
240 throw new UnsupportedOperationException(
241 "FullDetail must be true when using JsonToStringStyle");
242 }
243
244 super.append(buffer, fieldName, array, fullDetail);
245 }
246
247 @Override
248 public void append(final StringBuffer buffer, final String fieldName, final long[] array,
249 final Boolean fullDetail) {
250
251 if (fieldName == null) {
252 throw new UnsupportedOperationException(
253 "Field names are mandatory when using JsonToStringStyle");
254 }
255 if (!isFullDetail(fullDetail)) {
256 throw new UnsupportedOperationException(
257 "FullDetail must be true when using JsonToStringStyle");
258 }
259
260 super.append(buffer, fieldName, array, fullDetail);
261 }
262
263 @Override
264 public void append(final StringBuffer buffer, final String fieldName, final Object value,
265 final Boolean fullDetail) {
266
267 if (fieldName == null) {
268 throw new UnsupportedOperationException(
269 "Field names are mandatory when using JsonToStringStyle");
270 }
271 if (!isFullDetail(fullDetail)) {
272 throw new UnsupportedOperationException(
273 "FullDetail must be true when using JsonToStringStyle");
274 }
275
276 super.append(buffer, fieldName, value, fullDetail);
277 }
278
279 @Override
280 public void append(final StringBuffer buffer, final String fieldName,
281 final Object[] array, final Boolean fullDetail) {
282
283 if (fieldName == null) {
284 throw new UnsupportedOperationException(
285 "Field names are mandatory when using JsonToStringStyle");
286 }
287 if (!isFullDetail(fullDetail)) {
288 throw new UnsupportedOperationException(
289 "FullDetail must be true when using JsonToStringStyle");
290 }
291
292 super.append(buffer, fieldName, array, fullDetail);
293 }
294
295 @Override
296 public void append(final StringBuffer buffer, final String fieldName,
297 final short[] array, final Boolean fullDetail) {
298
299 if (fieldName == null) {
300 throw new UnsupportedOperationException(
301 "Field names are mandatory when using JsonToStringStyle");
302 }
303 if (!isFullDetail(fullDetail)) {
304 throw new UnsupportedOperationException(
305 "FullDetail must be true when using JsonToStringStyle");
306 }
307
308 super.append(buffer, fieldName, array, fullDetail);
309 }
310
311 @Override
312 protected void appendDetail(final StringBuffer buffer, final String fieldName, final char value) {
313 appendValueAsString(buffer, String.valueOf(value));
314 }
315
316 @Override
317 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) {
318 if (coll != null && !coll.isEmpty()) {
319 buffer.append(getArrayStart());
320 int i = 0;
321 for (final Object item : coll) {
322 appendDetail(buffer, fieldName, i++, item);
323 }
324 buffer.append(getArrayEnd());
325 return;
326 }
327
328 buffer.append(coll);
329 }
330
331 @Override
332 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Map<?, ?> map) {
333 if (map != null && !map.isEmpty()) {
334 buffer.append(getContentStart());
335
336 boolean firstItem = true;
337 for (final Entry<?, ?> entry : map.entrySet()) {
338 final String keyStr = Objects.toString(entry.getKey(), null);
339 if (keyStr != null) {
340 if (firstItem) {
341 firstItem = false;
342 } else {
343 appendFieldEnd(buffer, keyStr);
344 }
345 appendFieldStart(buffer, keyStr);
346 final Object value = entry.getValue();
347 if (value == null) {
348 appendNullText(buffer, keyStr);
349 } else {
350 appendInternal(buffer, keyStr, value, true);
351 }
352 }
353 }
354
355 buffer.append(getContentEnd());
356 return;
357 }
358
359 buffer.append(map);
360 }
361
362 @Override
363 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
364
365 if (value == null) {
366 appendNullText(buffer, fieldName);
367 return;
368 }
369
370 if (value instanceof String || value instanceof Character) {
371 appendValueAsString(buffer, value.toString());
372 return;
373 }
374
375 if (value instanceof Number || value instanceof Boolean) {
376 buffer.append(value);
377 return;
378 }
379
380 final String valueAsString = value.toString();
381 if (isJsonObject(valueAsString) || isJsonArray(valueAsString)) {
382 buffer.append(value);
383 return;
384 }
385
386 appendDetail(buffer, fieldName, valueAsString);
387 }
388
389 @Override
390 protected void appendFieldStart(final StringBuffer buffer, final String fieldName) {
391
392 if (fieldName == null) {
393 throw new UnsupportedOperationException(
394 "Field names are mandatory when using JsonToStringStyle");
395 }
396
397 super.appendFieldStart(buffer, FIELD_NAME_QUOTE + StringEscapeUtils.escapeJson(fieldName)
398 + FIELD_NAME_QUOTE);
399 }
400
401
402
403
404
405
406
407 private void appendValueAsString(final StringBuffer buffer, final String value) {
408 buffer.append('"').append(StringEscapeUtils.escapeJson(value)).append('"');
409 }
410
411 private boolean isJsonArray(final String valueAsString) {
412 return valueAsString.startsWith(getArrayStart())
413 && valueAsString.endsWith(getArrayEnd());
414 }
415
416 private boolean isJsonObject(final String valueAsString) {
417 return valueAsString.startsWith(getContentStart())
418 && valueAsString.endsWith(getContentEnd());
419 }
420
421
422
423
424
425
426 private Object readResolve() {
427 return JSON_STYLE;
428 }
429
430 }
431
432
433
434
435
436
437
438 private static final class MultiLineToStringStyle extends ToStringStyle {
439
440 private static final long serialVersionUID = 1L;
441
442
443
444
445
446
447 MultiLineToStringStyle() {
448 this.setContentStart("[");
449 this.setFieldSeparator(System.lineSeparator() + " ");
450 this.setFieldSeparatorAtStart(true);
451 this.setContentEnd(System.lineSeparator() + "]");
452 }
453
454
455
456
457
458
459 private Object readResolve() {
460 return MULTI_LINE_STYLE;
461 }
462
463 }
464
465
466
467
468
469
470
471
472 private static final class NoClassNameToStringStyle extends ToStringStyle {
473
474 private static final long serialVersionUID = 1L;
475
476
477
478
479
480
481 NoClassNameToStringStyle() {
482 this.setUseClassName(false);
483 this.setUseIdentityHashCode(false);
484 }
485
486
487
488
489
490
491 private Object readResolve() {
492 return NO_CLASS_NAME_STYLE;
493 }
494
495 }
496
497
498
499
500
501
502
503
504 private static final class NoFieldNameToStringStyle extends ToStringStyle {
505
506 private static final long serialVersionUID = 1L;
507
508
509
510
511
512
513 NoFieldNameToStringStyle() {
514 this.setUseFieldNames(false);
515 }
516
517
518
519
520
521
522 private Object readResolve() {
523 return NO_FIELD_NAMES_STYLE;
524 }
525
526 }
527
528
529
530
531
532
533
534
535 private static final class ShortPrefixToStringStyle extends ToStringStyle {
536
537 private static final long serialVersionUID = 1L;
538
539
540
541
542
543
544 ShortPrefixToStringStyle() {
545 this.setUseShortClassName(true);
546 this.setUseIdentityHashCode(false);
547 }
548
549
550
551
552
553 private Object readResolve() {
554 return SHORT_PREFIX_STYLE;
555 }
556
557 }
558
559
560
561
562
563
564
565
566 private static final class SimpleToStringStyle extends ToStringStyle {
567
568 private static final long serialVersionUID = 1L;
569
570
571
572
573
574
575 SimpleToStringStyle() {
576 this.setUseClassName(false);
577 this.setUseIdentityHashCode(false);
578 this.setUseFieldNames(false);
579 this.setContentStart(StringUtils.EMPTY);
580 this.setContentEnd(StringUtils.EMPTY);
581 }
582
583
584
585
586
587 private Object readResolve() {
588 return SIMPLE_STYLE;
589 }
590
591 }
592
593
594
595
596 private static final long serialVersionUID = -2587890625525655916L;
597
598
599
600
601
602
603
604
605
606 public static final ToStringStyle DEFAULT_STYLE = new DefaultToStringStyle();
607
608
609
610
611
612
613
614
615
616
617
618
619
620 public static final ToStringStyle MULTI_LINE_STYLE = new MultiLineToStringStyle();
621
622
623
624
625
626
627
628
629
630
631 public static final ToStringStyle NO_FIELD_NAMES_STYLE = new NoFieldNameToStringStyle();
632
633
634
635
636
637
638
639
640
641
642
643 public static final ToStringStyle SHORT_PREFIX_STYLE = new ShortPrefixToStringStyle();
644
645
646
647
648
649
650
651
652
653 public static final ToStringStyle SIMPLE_STYLE = new SimpleToStringStyle();
654
655
656
657
658
659
660
661
662
663
664
665 public static final ToStringStyle NO_CLASS_NAME_STYLE = new NoClassNameToStringStyle();
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684 public static final ToStringStyle JSON_STYLE = new JsonToStringStyle();
685
686
687
688
689
690
691 private static final ThreadLocal<WeakHashMap<Object, Object>> REGISTRY = new ThreadLocal<>();
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708 public static Map<Object, Object> getRegistry() {
709 return REGISTRY.get();
710 }
711
712
713
714
715
716
717
718
719
720
721 static boolean isRegistered(final Object value) {
722 final Map<Object, Object> m = getRegistry();
723 return m != null && m.containsKey(value);
724 }
725
726
727
728
729
730
731
732
733 static void register(final Object value) {
734 if (value != null) {
735 final Map<Object, Object> m = getRegistry();
736 if (m == null) {
737 REGISTRY.set(new WeakHashMap<>());
738 }
739 getRegistry().put(value, null);
740 }
741 }
742
743
744
745
746
747
748
749
750
751
752
753 static void unregister(final Object value) {
754 if (value != null) {
755 final Map<Object, Object> m = getRegistry();
756 if (m != null) {
757 m.remove(value);
758 if (m.isEmpty()) {
759 REGISTRY.remove();
760 }
761 }
762 }
763 }
764
765
766
767
768 private boolean useFieldNames = true;
769
770
771
772
773 private boolean useClassName = true;
774
775
776
777
778 private boolean useShortClassName;
779
780
781
782
783 private boolean useIdentityHashCode = true;
784
785
786
787
788 private String contentStart = "[";
789
790
791
792
793 private String contentEnd = "]";
794
795
796
797
798 private String fieldNameValueSeparator = "=";
799
800
801
802
803 private boolean fieldSeparatorAtStart;
804
805
806
807
808 private boolean fieldSeparatorAtEnd;
809
810
811
812
813 private String fieldSeparator = ",";
814
815
816
817
818 private String arrayStart = "{";
819
820
821
822
823 private String arraySeparator = ",";
824
825
826
827
828 private boolean arrayContentDetail = true;
829
830
831
832
833 private String arrayEnd = "}";
834
835
836
837
838
839 private boolean defaultFullDetail = true;
840
841
842
843
844 private String nullText = "<null>";
845
846
847
848
849 private String sizeStartText = "<size=";
850
851
852
853
854 private String sizeEndText = ">";
855
856
857
858
859 private String summaryObjectStartText = "<";
860
861
862
863
864 private String summaryObjectEndText = ">";
865
866
867
868
869 protected ToStringStyle() {
870 }
871
872
873
874
875
876
877
878
879
880 public void append(final StringBuffer buffer, final String fieldName, final boolean value) {
881 appendFieldStart(buffer, fieldName);
882 appendDetail(buffer, fieldName, value);
883 appendFieldEnd(buffer, fieldName);
884 }
885
886
887
888
889
890
891
892
893
894
895
896 public void append(final StringBuffer buffer, final String fieldName, final boolean[] array, final Boolean fullDetail) {
897 appendFieldStart(buffer, fieldName);
898
899 if (array == null) {
900 appendNullText(buffer, fieldName);
901
902 } else if (isFullDetail(fullDetail)) {
903 appendDetail(buffer, fieldName, array);
904
905 } else {
906 appendSummary(buffer, fieldName, array);
907 }
908
909 appendFieldEnd(buffer, fieldName);
910 }
911
912
913
914
915
916
917
918
919
920 public void append(final StringBuffer buffer, final String fieldName, final byte value) {
921 appendFieldStart(buffer, fieldName);
922 appendDetail(buffer, fieldName, value);
923 appendFieldEnd(buffer, fieldName);
924 }
925
926
927
928
929
930
931
932
933
934
935
936 public void append(final StringBuffer buffer, final String fieldName, final byte[] array, final Boolean fullDetail) {
937 appendFieldStart(buffer, fieldName);
938
939 if (array == null) {
940 appendNullText(buffer, fieldName);
941
942 } else if (isFullDetail(fullDetail)) {
943 appendDetail(buffer, fieldName, array);
944
945 } else {
946 appendSummary(buffer, fieldName, array);
947 }
948
949 appendFieldEnd(buffer, fieldName);
950 }
951
952
953
954
955
956
957
958
959
960 public void append(final StringBuffer buffer, final String fieldName, final char value) {
961 appendFieldStart(buffer, fieldName);
962 appendDetail(buffer, fieldName, value);
963 appendFieldEnd(buffer, fieldName);
964 }
965
966
967
968
969
970
971
972
973
974
975
976 public void append(final StringBuffer buffer, final String fieldName, final char[] array, final Boolean fullDetail) {
977 appendFieldStart(buffer, fieldName);
978
979 if (array == null) {
980 appendNullText(buffer, fieldName);
981
982 } else if (isFullDetail(fullDetail)) {
983 appendDetail(buffer, fieldName, array);
984
985 } else {
986 appendSummary(buffer, fieldName, array);
987 }
988
989 appendFieldEnd(buffer, fieldName);
990 }
991
992
993
994
995
996
997
998
999
1000 public void append(final StringBuffer buffer, final String fieldName, final double value) {
1001 appendFieldStart(buffer, fieldName);
1002 appendDetail(buffer, fieldName, value);
1003 appendFieldEnd(buffer, fieldName);
1004 }
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016 public void append(final StringBuffer buffer, final String fieldName, final double[] array, final Boolean fullDetail) {
1017 appendFieldStart(buffer, fieldName);
1018
1019 if (array == null) {
1020 appendNullText(buffer, fieldName);
1021
1022 } else if (isFullDetail(fullDetail)) {
1023 appendDetail(buffer, fieldName, array);
1024
1025 } else {
1026 appendSummary(buffer, fieldName, array);
1027 }
1028
1029 appendFieldEnd(buffer, fieldName);
1030 }
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040 public void append(final StringBuffer buffer, final String fieldName, final float value) {
1041 appendFieldStart(buffer, fieldName);
1042 appendDetail(buffer, fieldName, value);
1043 appendFieldEnd(buffer, fieldName);
1044 }
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056 public void append(final StringBuffer buffer, final String fieldName, final float[] array, final Boolean fullDetail) {
1057 appendFieldStart(buffer, fieldName);
1058
1059 if (array == null) {
1060 appendNullText(buffer, fieldName);
1061
1062 } else if (isFullDetail(fullDetail)) {
1063 appendDetail(buffer, fieldName, array);
1064
1065 } else {
1066 appendSummary(buffer, fieldName, array);
1067 }
1068
1069 appendFieldEnd(buffer, fieldName);
1070 }
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080 public void append(final StringBuffer buffer, final String fieldName, final int value) {
1081 appendFieldStart(buffer, fieldName);
1082 appendDetail(buffer, fieldName, value);
1083 appendFieldEnd(buffer, fieldName);
1084 }
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096 public void append(final StringBuffer buffer, final String fieldName, final int[] array, final Boolean fullDetail) {
1097 appendFieldStart(buffer, fieldName);
1098
1099 if (array == null) {
1100 appendNullText(buffer, fieldName);
1101
1102 } else if (isFullDetail(fullDetail)) {
1103 appendDetail(buffer, fieldName, array);
1104
1105 } else {
1106 appendSummary(buffer, fieldName, array);
1107 }
1108
1109 appendFieldEnd(buffer, fieldName);
1110 }
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120 public void append(final StringBuffer buffer, final String fieldName, final long value) {
1121 appendFieldStart(buffer, fieldName);
1122 appendDetail(buffer, fieldName, value);
1123 appendFieldEnd(buffer, fieldName);
1124 }
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136 public void append(final StringBuffer buffer, final String fieldName, final long[] array, final Boolean fullDetail) {
1137 appendFieldStart(buffer, fieldName);
1138
1139 if (array == null) {
1140 appendNullText(buffer, fieldName);
1141
1142 } else if (isFullDetail(fullDetail)) {
1143 appendDetail(buffer, fieldName, array);
1144
1145 } else {
1146 appendSummary(buffer, fieldName, array);
1147 }
1148
1149 appendFieldEnd(buffer, fieldName);
1150 }
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163 public void append(final StringBuffer buffer, final String fieldName, final Object value, final Boolean fullDetail) {
1164 appendFieldStart(buffer, fieldName);
1165
1166 if (value == null) {
1167 appendNullText(buffer, fieldName);
1168
1169 } else {
1170 appendInternal(buffer, fieldName, value, isFullDetail(fullDetail));
1171 }
1172
1173 appendFieldEnd(buffer, fieldName);
1174 }
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186 public void append(final StringBuffer buffer, final String fieldName, final Object[] array, final Boolean fullDetail) {
1187 appendFieldStart(buffer, fieldName);
1188
1189 if (array == null) {
1190 appendNullText(buffer, fieldName);
1191
1192 } else if (isFullDetail(fullDetail)) {
1193 appendDetail(buffer, fieldName, array);
1194
1195 } else {
1196 appendSummary(buffer, fieldName, array);
1197 }
1198
1199 appendFieldEnd(buffer, fieldName);
1200 }
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210 public void append(final StringBuffer buffer, final String fieldName, final short value) {
1211 appendFieldStart(buffer, fieldName);
1212 appendDetail(buffer, fieldName, value);
1213 appendFieldEnd(buffer, fieldName);
1214 }
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226 public void append(final StringBuffer buffer, final String fieldName, final short[] array, final Boolean fullDetail) {
1227 appendFieldStart(buffer, fieldName);
1228
1229 if (array == null) {
1230 appendNullText(buffer, fieldName);
1231
1232 } else if (isFullDetail(fullDetail)) {
1233 appendDetail(buffer, fieldName, array);
1234
1235 } else {
1236 appendSummary(buffer, fieldName, array);
1237 }
1238
1239 appendFieldEnd(buffer, fieldName);
1240 }
1241
1242
1243
1244
1245
1246
1247
1248 protected void appendClassName(final StringBuffer buffer, final Object object) {
1249 if (useClassName && object != null) {
1250 register(object);
1251 if (useShortClassName) {
1252 buffer.append(getShortClassName(object.getClass()));
1253 } else {
1254 buffer.append(object.getClass().getName());
1255 }
1256 }
1257 }
1258
1259
1260
1261
1262
1263
1264 protected void appendContentEnd(final StringBuffer buffer) {
1265 buffer.append(contentEnd);
1266 }
1267
1268
1269
1270
1271
1272
1273 protected void appendContentStart(final StringBuffer buffer) {
1274 buffer.append(contentStart);
1275 }
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289 protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) {
1290 ObjectUtils.identityToString(buffer, value);
1291 }
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301 protected void appendDetail(final StringBuffer buffer, final String fieldName, final boolean value) {
1302 buffer.append(value);
1303 }
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314 protected void appendDetail(final StringBuffer buffer, final String fieldName, final boolean[] array) {
1315 buffer.append(arrayStart);
1316 for (int i = 0; i < array.length; i++) {
1317 if (i > 0) {
1318 buffer.append(arraySeparator);
1319 }
1320 appendDetail(buffer, fieldName, array[i]);
1321 }
1322 buffer.append(arrayEnd);
1323 }
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333 protected void appendDetail(final StringBuffer buffer, final String fieldName, final byte value) {
1334 buffer.append(value);
1335 }
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346 protected void appendDetail(final StringBuffer buffer, final String fieldName, final byte[] array) {
1347 buffer.append(arrayStart);
1348 for (int i = 0; i < array.length; i++) {
1349 if (i > 0) {
1350 buffer.append(arraySeparator);
1351 }
1352 appendDetail(buffer, fieldName, array[i]);
1353 }
1354 buffer.append(arrayEnd);
1355 }
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365 protected void appendDetail(final StringBuffer buffer, final String fieldName, final char value) {
1366 buffer.append(value);
1367 }
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378 protected void appendDetail(final StringBuffer buffer, final String fieldName, final char[] array) {
1379 buffer.append(arrayStart);
1380 for (int i = 0; i < array.length; i++) {
1381 if (i > 0) {
1382 buffer.append(arraySeparator);
1383 }
1384 appendDetail(buffer, fieldName, array[i]);
1385 }
1386 buffer.append(arrayEnd);
1387 }
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) {
1398 buffer.append(coll);
1399 }
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409 protected void appendDetail(final StringBuffer buffer, final String fieldName, final double value) {
1410 buffer.append(value);
1411 }
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422 protected void appendDetail(final StringBuffer buffer, final String fieldName, final double[] array) {
1423 buffer.append(arrayStart);
1424 for (int i = 0; i < array.length; i++) {
1425 if (i > 0) {
1426 buffer.append(arraySeparator);
1427 }
1428 appendDetail(buffer, fieldName, array[i]);
1429 }
1430 buffer.append(arrayEnd);
1431 }
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441 protected void appendDetail(final StringBuffer buffer, final String fieldName, final float value) {
1442 buffer.append(value);
1443 }
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454 protected void appendDetail(final StringBuffer buffer, final String fieldName, final float[] array) {
1455 buffer.append(arrayStart);
1456 for (int i = 0; i < array.length; i++) {
1457 if (i > 0) {
1458 buffer.append(arraySeparator);
1459 }
1460 appendDetail(buffer, fieldName, array[i]);
1461 }
1462 buffer.append(arrayEnd);
1463 }
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473 protected void appendDetail(final StringBuffer buffer, final String fieldName, final int value) {
1474 buffer.append(value);
1475 }
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487 protected void appendDetail(final StringBuffer buffer, final String fieldName, final int i, final Object item) {
1488 if (i > 0) {
1489 buffer.append(arraySeparator);
1490 }
1491 if (item == null) {
1492 appendNullText(buffer, fieldName);
1493 } else {
1494 appendInternal(buffer, fieldName, item, arrayContentDetail);
1495 }
1496 }
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507 protected void appendDetail(final StringBuffer buffer, final String fieldName, final int[] array) {
1508 buffer.append(arrayStart);
1509 for (int i = 0; i < array.length; i++) {
1510 if (i > 0) {
1511 buffer.append(arraySeparator);
1512 }
1513 appendDetail(buffer, fieldName, array[i]);
1514 }
1515 buffer.append(arrayEnd);
1516 }
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526 protected void appendDetail(final StringBuffer buffer, final String fieldName, final long value) {
1527 buffer.append(value);
1528 }
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539 protected void appendDetail(final StringBuffer buffer, final String fieldName, final long[] array) {
1540 buffer.append(arrayStart);
1541 for (int i = 0; i < array.length; i++) {
1542 if (i > 0) {
1543 buffer.append(arraySeparator);
1544 }
1545 appendDetail(buffer, fieldName, array[i]);
1546 }
1547 buffer.append(arrayEnd);
1548 }
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Map<?, ?> map) {
1559 buffer.append(map);
1560 }
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
1572 buffer.append(value);
1573 }
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584 protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object[] array) {
1585 buffer.append(arrayStart);
1586 for (int i = 0; i < array.length; i++) {
1587 appendDetail(buffer, fieldName, i, array[i]);
1588 }
1589 buffer.append(arrayEnd);
1590 }
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600 protected void appendDetail(final StringBuffer buffer, final String fieldName, final short value) {
1601 buffer.append(value);
1602 }
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613 protected void appendDetail(final StringBuffer buffer, final String fieldName, final short[] array) {
1614 buffer.append(arrayStart);
1615 for (int i = 0; i < array.length; i++) {
1616 if (i > 0) {
1617 buffer.append(arraySeparator);
1618 }
1619 appendDetail(buffer, fieldName, array[i]);
1620 }
1621 buffer.append(arrayEnd);
1622 }
1623
1624
1625
1626
1627
1628
1629
1630
1631 public void appendEnd(final StringBuffer buffer, final Object object) {
1632 if (!this.fieldSeparatorAtEnd) {
1633 removeLastFieldSeparator(buffer);
1634 }
1635 appendContentEnd(buffer);
1636 unregister(object);
1637 }
1638
1639
1640
1641
1642
1643
1644
1645 protected void appendFieldEnd(final StringBuffer buffer, final String fieldName) {
1646 appendFieldSeparator(buffer);
1647 }
1648
1649
1650
1651
1652
1653
1654 protected void appendFieldSeparator(final StringBuffer buffer) {
1655 buffer.append(fieldSeparator);
1656 }
1657
1658
1659
1660
1661
1662
1663
1664 protected void appendFieldStart(final StringBuffer buffer, final String fieldName) {
1665 if (useFieldNames && fieldName != null) {
1666 buffer.append(fieldName);
1667 buffer.append(fieldNameValueSeparator);
1668 }
1669 }
1670
1671
1672
1673
1674
1675
1676
1677 protected void appendIdentityHashCode(final StringBuffer buffer, final Object object) {
1678 if (this.isUseIdentityHashCode() && object != null) {
1679 register(object);
1680 buffer.append('@');
1681 buffer.append(ObjectUtils.identityHashCodeHex(object));
1682 }
1683 }
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704 protected void appendInternal(final StringBuffer buffer, final String fieldName, final Object value, final boolean detail) {
1705 if (isRegistered(value)
1706 && !(value instanceof Number || value instanceof Boolean || value instanceof Character)) {
1707 appendCyclicObject(buffer, fieldName, value);
1708 return;
1709 }
1710
1711 register(value);
1712
1713 try {
1714 if (value instanceof Collection<?>) {
1715 if (detail) {
1716 appendDetail(buffer, fieldName, (Collection<?>) value);
1717 } else {
1718 appendSummarySize(buffer, fieldName, ((Collection<?>) value).size());
1719 }
1720
1721 } else if (value instanceof Map<?, ?>) {
1722 if (detail) {
1723 appendDetail(buffer, fieldName, (Map<?, ?>) value);
1724 } else {
1725 appendSummarySize(buffer, fieldName, ((Map<?, ?>) value).size());
1726 }
1727
1728 } else if (value instanceof long[]) {
1729 if (detail) {
1730 appendDetail(buffer, fieldName, (long[]) value);
1731 } else {
1732 appendSummary(buffer, fieldName, (long[]) value);
1733 }
1734
1735 } else if (value instanceof int[]) {
1736 if (detail) {
1737 appendDetail(buffer, fieldName, (int[]) value);
1738 } else {
1739 appendSummary(buffer, fieldName, (int[]) value);
1740 }
1741
1742 } else if (value instanceof short[]) {
1743 if (detail) {
1744 appendDetail(buffer, fieldName, (short[]) value);
1745 } else {
1746 appendSummary(buffer, fieldName, (short[]) value);
1747 }
1748
1749 } else if (value instanceof byte[]) {
1750 if (detail) {
1751 appendDetail(buffer, fieldName, (byte[]) value);
1752 } else {
1753 appendSummary(buffer, fieldName, (byte[]) value);
1754 }
1755
1756 } else if (value instanceof char[]) {
1757 if (detail) {
1758 appendDetail(buffer, fieldName, (char[]) value);
1759 } else {
1760 appendSummary(buffer, fieldName, (char[]) value);
1761 }
1762
1763 } else if (value instanceof double[]) {
1764 if (detail) {
1765 appendDetail(buffer, fieldName, (double[]) value);
1766 } else {
1767 appendSummary(buffer, fieldName, (double[]) value);
1768 }
1769
1770 } else if (value instanceof float[]) {
1771 if (detail) {
1772 appendDetail(buffer, fieldName, (float[]) value);
1773 } else {
1774 appendSummary(buffer, fieldName, (float[]) value);
1775 }
1776
1777 } else if (value instanceof boolean[]) {
1778 if (detail) {
1779 appendDetail(buffer, fieldName, (boolean[]) value);
1780 } else {
1781 appendSummary(buffer, fieldName, (boolean[]) value);
1782 }
1783
1784 } else if (ObjectUtils.isArray(value)) {
1785 if (detail) {
1786 appendDetail(buffer, fieldName, (Object[]) value);
1787 } else {
1788 appendSummary(buffer, fieldName, (Object[]) value);
1789 }
1790
1791 } else if (detail) {
1792 appendDetail(buffer, fieldName, value);
1793 } else {
1794 appendSummary(buffer, fieldName, value);
1795 }
1796 } finally {
1797 unregister(value);
1798 }
1799 }
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809 protected void appendNullText(final StringBuffer buffer, final String fieldName) {
1810 buffer.append(nullText);
1811 }
1812
1813
1814
1815
1816
1817
1818
1819 public void appendStart(final StringBuffer buffer, final Object object) {
1820 if (object != null) {
1821 appendClassName(buffer, object);
1822 appendIdentityHashCode(buffer, object);
1823 appendContentStart(buffer);
1824 if (fieldSeparatorAtStart) {
1825 appendFieldSeparator(buffer);
1826 }
1827 }
1828 }
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839 protected void appendSummary(final StringBuffer buffer, final String fieldName, final boolean[] array) {
1840 appendSummarySize(buffer, fieldName, array.length);
1841 }
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852 protected void appendSummary(final StringBuffer buffer, final String fieldName, final byte[] array) {
1853 appendSummarySize(buffer, fieldName, array.length);
1854 }
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865 protected void appendSummary(final StringBuffer buffer, final String fieldName, final char[] array) {
1866 appendSummarySize(buffer, fieldName, array.length);
1867 }
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878 protected void appendSummary(final StringBuffer buffer, final String fieldName, final double[] array) {
1879 appendSummarySize(buffer, fieldName, array.length);
1880 }
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891 protected void appendSummary(final StringBuffer buffer, final String fieldName, final float[] array) {
1892 appendSummarySize(buffer, fieldName, array.length);
1893 }
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904 protected void appendSummary(final StringBuffer buffer, final String fieldName, final int[] array) {
1905 appendSummarySize(buffer, fieldName, array.length);
1906 }
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917 protected void appendSummary(final StringBuffer buffer, final String fieldName, final long[] array) {
1918 appendSummarySize(buffer, fieldName, array.length);
1919 }
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930 protected void appendSummary(final StringBuffer buffer, final String fieldName, final Object value) {
1931 buffer.append(summaryObjectStartText);
1932 buffer.append(getShortClassName(value.getClass()));
1933 buffer.append(summaryObjectEndText);
1934 }
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945 protected void appendSummary(final StringBuffer buffer, final String fieldName, final Object[] array) {
1946 appendSummarySize(buffer, fieldName, array.length);
1947 }
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958 protected void appendSummary(final StringBuffer buffer, final String fieldName, final short[] array) {
1959 appendSummarySize(buffer, fieldName, array.length);
1960 }
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977 protected void appendSummarySize(final StringBuffer buffer, final String fieldName, final int size) {
1978 buffer.append(sizeStartText);
1979 buffer.append(size);
1980 buffer.append(sizeEndText);
1981 }
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993 public void appendSuper(final StringBuffer buffer, final String superToString) {
1994 appendToString(buffer, superToString);
1995 }
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007 public void appendToString(final StringBuffer buffer, final String toString) {
2008 if (toString != null) {
2009 final int pos1 = toString.indexOf(contentStart) + contentStart.length();
2010 final int pos2 = toString.lastIndexOf(contentEnd);
2011 if (pos1 != pos2 && pos1 >= 0 && pos2 >= 0) {
2012 if (fieldSeparatorAtStart) {
2013 removeLastFieldSeparator(buffer);
2014 }
2015 buffer.append(toString, pos1, pos2);
2016 appendFieldSeparator(buffer);
2017 }
2018 }
2019 }
2020
2021
2022
2023
2024
2025
2026 protected String getArrayEnd() {
2027 return arrayEnd;
2028 }
2029
2030
2031
2032
2033
2034
2035 protected String getArraySeparator() {
2036 return arraySeparator;
2037 }
2038
2039
2040
2041
2042
2043
2044 protected String getArrayStart() {
2045 return arrayStart;
2046 }
2047
2048
2049
2050
2051
2052
2053 protected String getContentEnd() {
2054 return contentEnd;
2055 }
2056
2057
2058
2059
2060
2061
2062 protected String getContentStart() {
2063 return contentStart;
2064 }
2065
2066
2067
2068
2069
2070
2071 protected String getFieldNameValueSeparator() {
2072 return fieldNameValueSeparator;
2073 }
2074
2075
2076
2077
2078
2079
2080 protected String getFieldSeparator() {
2081 return fieldSeparator;
2082 }
2083
2084
2085
2086
2087
2088
2089 protected String getNullText() {
2090 return nullText;
2091 }
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102 protected String getShortClassName(final Class<?> cls) {
2103 return ClassUtils.getShortClassName(cls);
2104 }
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114 protected String getSizeEndText() {
2115 return sizeEndText;
2116 }
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126 protected String getSizeStartText() {
2127 return sizeStartText;
2128 }
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138 protected String getSummaryObjectEndText() {
2139 return summaryObjectEndText;
2140 }
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150 protected String getSummaryObjectStartText() {
2151 return summaryObjectStartText;
2152 }
2153
2154
2155
2156
2157
2158
2159 protected boolean isArrayContentDetail() {
2160 return arrayContentDetail;
2161 }
2162
2163
2164
2165
2166
2167
2168
2169 protected boolean isDefaultFullDetail() {
2170 return defaultFullDetail;
2171 }
2172
2173
2174
2175
2176
2177
2178
2179
2180 protected boolean isFieldSeparatorAtEnd() {
2181 return fieldSeparatorAtEnd;
2182 }
2183
2184
2185
2186
2187
2188
2189
2190
2191 protected boolean isFieldSeparatorAtStart() {
2192 return fieldSeparatorAtStart;
2193 }
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209 protected boolean isFullDetail(final Boolean fullDetailRequest) {
2210 if (fullDetailRequest == null) {
2211 return defaultFullDetail;
2212 }
2213 return fullDetailRequest.booleanValue();
2214 }
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224 protected boolean isUseClassName() {
2225 return useClassName;
2226 }
2227
2228
2229
2230
2231
2232
2233 protected boolean isUseFieldNames() {
2234 return useFieldNames;
2235 }
2236
2237
2238
2239
2240
2241
2242 protected boolean isUseIdentityHashCode() {
2243 return useIdentityHashCode;
2244 }
2245
2246
2247
2248
2249
2250
2251
2252 protected boolean isUseShortClassName() {
2253 return useShortClassName;
2254 }
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265 protected void reflectionAppendArrayDetail(final StringBuffer buffer, final String fieldName, final Object array) {
2266 buffer.append(arrayStart);
2267 final int length = Array.getLength(array);
2268 for (int i = 0; i < length; i++) {
2269 appendDetail(buffer, fieldName, i, Array.get(array, i));
2270 }
2271 buffer.append(arrayEnd);
2272 }
2273
2274
2275
2276
2277
2278
2279
2280 protected void removeLastFieldSeparator(final StringBuffer buffer) {
2281 if (StringUtils.endsWith(buffer, fieldSeparator)) {
2282 buffer.setLength(buffer.length() - fieldSeparator.length());
2283 }
2284 }
2285
2286
2287
2288
2289
2290
2291 protected void setArrayContentDetail(final boolean arrayContentDetail) {
2292 this.arrayContentDetail = arrayContentDetail;
2293 }
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303 protected void setArrayEnd(String arrayEnd) {
2304 if (arrayEnd == null) {
2305 arrayEnd = StringUtils.EMPTY;
2306 }
2307 this.arrayEnd = arrayEnd;
2308 }
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318 protected void setArraySeparator(String arraySeparator) {
2319 if (arraySeparator == null) {
2320 arraySeparator = StringUtils.EMPTY;
2321 }
2322 this.arraySeparator = arraySeparator;
2323 }
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333 protected void setArrayStart(String arrayStart) {
2334 if (arrayStart == null) {
2335 arrayStart = StringUtils.EMPTY;
2336 }
2337 this.arrayStart = arrayStart;
2338 }
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348 protected void setContentEnd(String contentEnd) {
2349 if (contentEnd == null) {
2350 contentEnd = StringUtils.EMPTY;
2351 }
2352 this.contentEnd = contentEnd;
2353 }
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363 protected void setContentStart(String contentStart) {
2364 if (contentStart == null) {
2365 contentStart = StringUtils.EMPTY;
2366 }
2367 this.contentStart = contentStart;
2368 }
2369
2370
2371
2372
2373
2374
2375
2376 protected void setDefaultFullDetail(final boolean defaultFullDetail) {
2377 this.defaultFullDetail = defaultFullDetail;
2378 }
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388 protected void setFieldNameValueSeparator(String fieldNameValueSeparator) {
2389 if (fieldNameValueSeparator == null) {
2390 fieldNameValueSeparator = StringUtils.EMPTY;
2391 }
2392 this.fieldNameValueSeparator = fieldNameValueSeparator;
2393 }
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403 protected void setFieldSeparator(String fieldSeparator) {
2404 if (fieldSeparator == null) {
2405 fieldSeparator = StringUtils.EMPTY;
2406 }
2407 this.fieldSeparator = fieldSeparator;
2408 }
2409
2410
2411
2412
2413
2414
2415
2416
2417 protected void setFieldSeparatorAtEnd(final boolean fieldSeparatorAtEnd) {
2418 this.fieldSeparatorAtEnd = fieldSeparatorAtEnd;
2419 }
2420
2421
2422
2423
2424
2425
2426
2427
2428 protected void setFieldSeparatorAtStart(final boolean fieldSeparatorAtStart) {
2429 this.fieldSeparatorAtStart = fieldSeparatorAtStart;
2430 }
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440 protected void setNullText(String nullText) {
2441 if (nullText == null) {
2442 nullText = StringUtils.EMPTY;
2443 }
2444 this.nullText = nullText;
2445 }
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458 protected void setSizeEndText(String sizeEndText) {
2459 if (sizeEndText == null) {
2460 sizeEndText = StringUtils.EMPTY;
2461 }
2462 this.sizeEndText = sizeEndText;
2463 }
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476 protected void setSizeStartText(String sizeStartText) {
2477 if (sizeStartText == null) {
2478 sizeStartText = StringUtils.EMPTY;
2479 }
2480 this.sizeStartText = sizeStartText;
2481 }
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494 protected void setSummaryObjectEndText(String summaryObjectEndText) {
2495 if (summaryObjectEndText == null) {
2496 summaryObjectEndText = StringUtils.EMPTY;
2497 }
2498 this.summaryObjectEndText = summaryObjectEndText;
2499 }
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512 protected void setSummaryObjectStartText(String summaryObjectStartText) {
2513 if (summaryObjectStartText == null) {
2514 summaryObjectStartText = StringUtils.EMPTY;
2515 }
2516 this.summaryObjectStartText = summaryObjectStartText;
2517 }
2518
2519
2520
2521
2522
2523
2524 protected void setUseClassName(final boolean useClassName) {
2525 this.useClassName = useClassName;
2526 }
2527
2528
2529
2530
2531
2532
2533 protected void setUseFieldNames(final boolean useFieldNames) {
2534 this.useFieldNames = useFieldNames;
2535 }
2536
2537
2538
2539
2540
2541
2542 protected void setUseIdentityHashCode(final boolean useIdentityHashCode) {
2543 this.useIdentityHashCode = useIdentityHashCode;
2544 }
2545
2546
2547
2548
2549
2550
2551
2552 protected void setUseShortClassName(final boolean useShortClassName) {
2553 this.useShortClassName = useShortClassName;
2554 }
2555 }