KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > lang > builder > StandardToStringStyle


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.lang.builder;
17
18 /**
19  * <p>Works with {@link ToStringBuilder} to create a <code>toString</code>.</p>
20  *
21  * <p>This class is intended to be used as a singleton.
22  * There is no need to instantiate a new style each time.
23  * Simply instantiate the class once, customize the values as required, and
24  * store the result in a public static final variable for the rest of the
25  * program to access.</p>
26  *
27  * @author Stephen Colebourne
28  * @author Pete Gieser
29  * @author Gary Gregory
30  * @since 1.0
31  * @version $Id: StandardToStringStyle.java 161243 2005-04-14 04:30:28Z ggregory $
32  */

33 public class StandardToStringStyle extends ToStringStyle {
34     
35     /**
36      * <p>Constructor.</p>
37      */

38     public StandardToStringStyle() {
39         super();
40     }
41     
42     //---------------------------------------------------------------------
43

44     /**
45      * <p>Gets whether to use the class name.</p>
46      *
47      * @return the current useClassName flag
48      */

49     public boolean isUseClassName() {
50         return super.isUseClassName();
51     }
52
53     /**
54      * <p>Sets whether to use the class name.</p>
55      *
56      * @param useClassName the new useClassName flag
57      */

58     public void setUseClassName(boolean useClassName) {
59         super.setUseClassName(useClassName);
60     }
61
62     //---------------------------------------------------------------------
63

64     /**
65      * <p>Gets whether to output short or long class names.</p>
66      *
67      * @return the current useShortClassName flag
68      * @since 2.0
69      */

70     public boolean isUseShortClassName() {
71         return super.isUseShortClassName();
72     }
73
74     /**
75      * <p>Gets whether to output short or long class names.</p>
76      *
77      * @return the current shortClassName flag
78      * @deprecated Use {@link #isUseShortClassName()}
79      * Method will be removed in Commons Lang 3.0.
80      */

81     public boolean isShortClassName() {
82         return super.isUseShortClassName();
83     }
84
85     /**
86      * <p>Sets whether to output short or long class names.</p>
87      *
88      * @param useShortClassName the new useShortClassName flag
89      * @since 2.0
90      */

91     public void setUseShortClassName(boolean useShortClassName) {
92         super.setUseShortClassName(useShortClassName);
93     }
94
95     /**
96      * <p>Sets whether to output short or long class names.</p>
97      *
98      * @param shortClassName the new shortClassName flag
99      * @deprecated Use {@link #setUseShortClassName(boolean)}
100      * Method will be removed in Commons Lang 3.0.
101      */

102     public void setShortClassName(boolean shortClassName) {
103         super.setUseShortClassName(shortClassName);
104     }
105
106     //---------------------------------------------------------------------
107

108     /**
109      * <p>Gets whether to use the identity hash code.</p>
110      * @return the current useIdentityHashCode flag
111      */

112     public boolean isUseIdentityHashCode() {
113         return super.isUseIdentityHashCode();
114     }
115
116     /**
117      * <p>Sets whether to use the identity hash code.</p>
118      *
119      * @param useIdentityHashCode the new useIdentityHashCode flag
120      */

121     public void setUseIdentityHashCode(boolean useIdentityHashCode) {
122         super.setUseIdentityHashCode(useIdentityHashCode);
123     }
124
125     //---------------------------------------------------------------------
126

127     /**
128      * <p>Gets whether to use the field names passed in.</p>
129      *
130      * @return the current useFieldNames flag
131      */

132     public boolean isUseFieldNames() {
133         return super.isUseFieldNames();
134     }
135
136     /**
137      * <p>Sets whether to use the field names passed in.</p>
138      *
139      * @param useFieldNames the new useFieldNames flag
140      */

141     public void setUseFieldNames(boolean useFieldNames) {
142         super.setUseFieldNames(useFieldNames);
143     }
144
145     //---------------------------------------------------------------------
146

147     /**
148      * <p>Gets whether to use full detail when the caller doesn't
149      * specify.</p>
150      *
151      * @return the current defaultFullDetail flag
152      */

153     public boolean isDefaultFullDetail() {
154         return super.isDefaultFullDetail();
155     }
156
157     /**
158      * <p>Sets whether to use full detail when the caller doesn't
159      * specify.</p>
160      *
161      * @param defaultFullDetail the new defaultFullDetail flag
162      */

163     public void setDefaultFullDetail(boolean defaultFullDetail) {
164         super.setDefaultFullDetail(defaultFullDetail);
165     }
166
167     //---------------------------------------------------------------------
168

169     /**
170      * <p>Gets whether to output array content detail.</p>
171      *
172      * @return the current array content detail setting
173      */

174     public boolean isArrayContentDetail() {
175         return super.isArrayContentDetail();
176     }
177     
178     /**
179      * <p>Sets whether to output array content detail.</p>
180      *
181      * @param arrayContentDetail the new arrayContentDetail flag
182      */

183     public void setArrayContentDetail(boolean arrayContentDetail) {
184         super.setArrayContentDetail(arrayContentDetail);
185     }
186
187     //---------------------------------------------------------------------
188

189     /**
190      * <p>Gets the array start text.</p>
191      *
192      * @return the current array start text
193      */

194     public String JavaDoc getArrayStart() {
195         return super.getArrayStart();
196     }
197
198     /**
199      * <p>Sets the array start text.</p>
200      *
201      * <p><code>null</code> is accepted, but will be converted
202      * to an empty String.</p>
203      *
204      * @param arrayStart the new array start text
205      */

206     public void setArrayStart(String JavaDoc arrayStart) {
207         super.setArrayStart(arrayStart);
208     }
209
210     //---------------------------------------------------------------------
211

212     /**
213      * <p>Gets the array end text.</p>
214      *
215      * @return the current array end text
216      */

217     public String JavaDoc getArrayEnd() {
218         return super.getArrayEnd();
219     }
220
221     /**
222      * <p>Sets the array end text.</p>
223      *
224      * <p><code>null</code> is accepted, but will be converted
225      * to an empty String.</p>
226      *
227      * @param arrayEnd the new array end text
228      */

229     public void setArrayEnd(String JavaDoc arrayEnd) {
230         super.setArrayEnd(arrayEnd);
231     }
232
233     //---------------------------------------------------------------------
234

235     /**
236      * <p>Gets the array separator text.</p>
237      *
238      * @return the current array separator text
239      */

240     public String JavaDoc getArraySeparator() {
241         return super.getArraySeparator();
242     }
243
244     /**
245      * <p>Sets the array separator text.</p>
246      *
247      * <p><code>null</code> is accepted, but will be converted
248      * to an empty String.</p>
249      *
250      * @param arraySeparator the new array separator text
251      */

252     public void setArraySeparator(String JavaDoc arraySeparator) {
253         super.setArraySeparator(arraySeparator);
254     }
255
256     //---------------------------------------------------------------------
257

258     /**
259      * <p>Gets the content start text.</p>
260      *
261      * @return the current content start text
262      */

263     public String JavaDoc getContentStart() {
264         return super.getContentStart();
265     }
266
267     /**
268      * <p>Sets the content start text.</p>
269      *
270      * <p><code>null</code> is accepted, but will be converted
271      * to an empty String.</p>
272      *
273      * @param contentStart the new content start text
274      */

275     public void setContentStart(String JavaDoc contentStart) {
276         super.setContentStart(contentStart);
277     }
278
279     //---------------------------------------------------------------------
280

281     /**
282      * <p>Gets the content end text.</p>
283      *
284      * @return the current content end text
285      */

286     public String JavaDoc getContentEnd() {
287         return super.getContentEnd();
288     }
289
290     /**
291      * <p>Sets the content end text.</p>
292      *
293      * <p><code>null</code> is accepted, but will be converted
294      * to an empty String.</p>
295      *
296      * @param contentEnd the new content end text
297      */

298     public void setContentEnd(String JavaDoc contentEnd) {
299         super.setContentEnd(contentEnd);
300     }
301
302     //---------------------------------------------------------------------
303

304     /**
305      * <p>Gets the field name value separator text.</p>
306      *
307      * @return the current field name value separator text
308      */

309     public String JavaDoc getFieldNameValueSeparator() {
310         return super.getFieldNameValueSeparator();
311     }
312
313     /**
314      * <p>Sets the field name value separator text.</p>
315      *
316      * <p><code>null</code> is accepted, but will be converted
317      * to an empty String.</p>
318      *
319      * @param fieldNameValueSeparator the new field name value separator text
320      */

321     public void setFieldNameValueSeparator(String JavaDoc fieldNameValueSeparator) {
322         super.setFieldNameValueSeparator(fieldNameValueSeparator);
323     }
324
325     //---------------------------------------------------------------------
326

327     /**
328      * <p>Gets the field separator text.</p>
329      *
330      * @return the current field separator text
331      */

332     public String JavaDoc getFieldSeparator() {
333         return super.getFieldSeparator();
334     }
335
336     /**
337      * <p>Sets the field separator text.</p>
338      *
339      * <p><code>null</code> is accepted, but will be converted
340      * to an empty String.</p>
341      *
342      * @param fieldSeparator the new field separator text
343      */

344     public void setFieldSeparator(String JavaDoc fieldSeparator) {
345         super.setFieldSeparator(fieldSeparator);
346     }
347
348     //---------------------------------------------------------------------
349

350     /**
351      * <p>Gets whether the field separator should be added at the start
352      * of each buffer.</p>
353      *
354      * @return the fieldSeparatorAtStart flag
355      * @since 2.0
356      */

357     public boolean isFieldSeparatorAtStart() {
358         return super.isFieldSeparatorAtStart();
359     }
360
361     /**
362      * <p>Sets whether the field separator should be added at the start
363      * of each buffer.</p>
364      *
365      * @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
366      * @since 2.0
367      */

368     public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) {
369         super.setFieldSeparatorAtStart(fieldSeparatorAtStart);
370     }
371
372     //---------------------------------------------------------------------
373

374     /**
375      * <p>Gets whether the field separator should be added at the end
376      * of each buffer.</p>
377      *
378      * @return fieldSeparatorAtEnd flag
379      * @since 2.0
380      */

381     public boolean isFieldSeparatorAtEnd() {
382         return super.isFieldSeparatorAtEnd();
383     }
384
385     /**
386      * <p>Sets whether the field separator should be added at the end
387      * of each buffer.</p>
388      *
389      * @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
390      * @since 2.0
391      */

392     public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) {
393         super.setFieldSeparatorAtEnd(fieldSeparatorAtEnd);
394     }
395
396     //---------------------------------------------------------------------
397

398     /**
399      * <p>Gets the text to output when <code>null</code> found.</p>
400      *
401      * @return the current text to output when <code>null</code> found
402      */

403     public String JavaDoc getNullText() {
404         return super.getNullText();
405     }
406
407     /**
408      * <p>Sets the text to output when <code>null</code> found.</p>
409      *
410      * <p><code>null</code> is accepted, but will be converted
411      * to an empty String.</p>
412      *
413      * @param nullText the new text to output when <code>null</code> found
414      */

415     public void setNullText(String JavaDoc nullText) {
416         super.setNullText(nullText);
417     }
418
419     //---------------------------------------------------------------------
420

421     /**
422      * <p>Gets the text to output when a <code>Collection</code>,
423      * <code>Map</code> or <code>Array</code> size is output.</p>
424      *
425      * <p>This is output before the size value.</p>
426      *
427      * @return the current start of size text
428      */

429     public String JavaDoc getSizeStartText() {
430         return super.getSizeStartText();
431     }
432
433     /**
434      * <p>Sets the start text to output when a <code>Collection</code>,
435      * <code>Map</code> or <code>Array</code> size is output.</p>
436      *
437      * <p>This is output before the size value.</p>
438      *
439      * <p><code>null</code> is accepted, but will be converted to
440      * an empty String.</p>
441      *
442      * @param sizeStartText the new start of size text
443      */

444     public void setSizeStartText(String JavaDoc sizeStartText) {
445         super.setSizeStartText(sizeStartText);
446     }
447
448     //---------------------------------------------------------------------
449

450     /**
451      * Gets the end text to output when a <code>Collection</code>,
452      * <code>Map</code> or <code>Array</code> size is output.</p>
453      *
454      * <p>This is output after the size value.</p>
455      *
456      * @return the current end of size text
457      */

458     public String JavaDoc getSizeEndText() {
459         return super.getSizeEndText();
460     }
461
462     /**
463      * <p>Sets the end text to output when a <code>Collection</code>,
464      * <code>Map</code> or <code>Array</code> size is output.</p>
465      *
466      * <p>This is output after the size value.</p>
467      *
468      * <p><code>null</code> is accepted, but will be converted
469      * to an empty String.</p>
470      *
471      * @param sizeEndText the new end of size text
472      */

473     public void setSizeEndText(String JavaDoc sizeEndText) {
474         super.setSizeEndText(sizeEndText);
475     }
476
477     //---------------------------------------------------------------------
478

479     /**
480      * <p>Gets the start text to output when an <code>Object</code> is
481      * output in summary mode.</p>
482      *
483      * <P>This is output before the size value.</p>
484      *
485      * @return the current start of summary text
486      */

487     public String JavaDoc getSummaryObjectStartText() {
488         return super.getSummaryObjectStartText();
489     }
490
491     /**
492      * <p>Sets the start text to output when an <code>Object</code> is
493      * output in summary mode.</p>
494      *
495      * <p>This is output before the size value.</p>
496      *
497      * <p><code>null</code> is accepted, but will be converted to
498      * an empty String.</p>
499      *
500      * @param summaryObjectStartText the new start of summary text
501      */

502     public void setSummaryObjectStartText(String JavaDoc summaryObjectStartText) {
503         super.setSummaryObjectStartText(summaryObjectStartText);
504     }
505
506     //---------------------------------------------------------------------
507

508     /**
509      * <p>Gets the end text to output when an <code>Object</code> is
510      * output in summary mode.</p>
511      *
512      * <p>This is output after the size value.</p>
513      *
514      * @return the current end of summary text
515      */

516     public String JavaDoc getSummaryObjectEndText() {
517         return super.getSummaryObjectEndText();
518     }
519
520     /**
521      * <p>Sets the end text to output when an <code>Object</code> is
522      * output in summary mode.</p>
523      *
524      * <p>This is output after the size value.</p>
525      *
526      * <p><code>null</code> is accepted, but will be converted to
527      * an empty String.</p>
528      *
529      * @param summaryObjectEndText the new end of summary text
530      */

531     public void setSummaryObjectEndText(String JavaDoc summaryObjectEndText) {
532         super.setSummaryObjectEndText(summaryObjectEndText);
533     }
534
535     //---------------------------------------------------------------------
536

537 }
538
Popular Tags