001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.lang3.builder;
018
019 /**
020 * <p>Works with {@link ToStringBuilder} to create a <code>toString</code>.</p>
021 *
022 * <p>This class is intended to be used as a singleton.
023 * There is no need to instantiate a new style each time.
024 * Simply instantiate the class once, customize the values as required, and
025 * store the result in a public static final variable for the rest of the
026 * program to access.</p>
027 *
028 * @author Apache Software Foundation
029 * @author Pete Gieser
030 * @author Gary Gregory
031 * @since 1.0
032 * @version $Id: StandardToStringStyle.java 889215 2009-12-10 11:56:38Z bayard $
033 */
034 public class StandardToStringStyle extends ToStringStyle {
035
036 /**
037 * Required for serialization support.
038 *
039 * @see java.io.Serializable
040 */
041 private static final long serialVersionUID = 1L;
042
043 /**
044 * <p>Constructor.</p>
045 */
046 public StandardToStringStyle() {
047 super();
048 }
049
050 //---------------------------------------------------------------------
051
052 /**
053 * <p>Gets whether to use the class name.</p>
054 *
055 * @return the current useClassName flag
056 */
057 @Override
058 public boolean isUseClassName() {
059 return super.isUseClassName();
060 }
061
062 /**
063 * <p>Sets whether to use the class name.</p>
064 *
065 * @param useClassName the new useClassName flag
066 */
067 @Override
068 public void setUseClassName(boolean useClassName) {
069 super.setUseClassName(useClassName);
070 }
071
072 //---------------------------------------------------------------------
073
074 /**
075 * <p>Gets whether to output short or long class names.</p>
076 *
077 * @return the current useShortClassName flag
078 * @since 2.0
079 */
080 @Override
081 public boolean isUseShortClassName() {
082 return super.isUseShortClassName();
083 }
084
085 /**
086 * <p>Sets whether to output short or long class names.</p>
087 *
088 * @param useShortClassName the new useShortClassName flag
089 * @since 2.0
090 */
091 @Override
092 public void setUseShortClassName(boolean useShortClassName) {
093 super.setUseShortClassName(useShortClassName);
094 }
095
096 //---------------------------------------------------------------------
097
098 /**
099 * <p>Gets whether to use the identity hash code.</p>
100 * @return the current useIdentityHashCode flag
101 */
102 @Override
103 public boolean isUseIdentityHashCode() {
104 return super.isUseIdentityHashCode();
105 }
106
107 /**
108 * <p>Sets whether to use the identity hash code.</p>
109 *
110 * @param useIdentityHashCode the new useIdentityHashCode flag
111 */
112 @Override
113 public void setUseIdentityHashCode(boolean useIdentityHashCode) {
114 super.setUseIdentityHashCode(useIdentityHashCode);
115 }
116
117 //---------------------------------------------------------------------
118
119 /**
120 * <p>Gets whether to use the field names passed in.</p>
121 *
122 * @return the current useFieldNames flag
123 */
124 @Override
125 public boolean isUseFieldNames() {
126 return super.isUseFieldNames();
127 }
128
129 /**
130 * <p>Sets whether to use the field names passed in.</p>
131 *
132 * @param useFieldNames the new useFieldNames flag
133 */
134 @Override
135 public void setUseFieldNames(boolean useFieldNames) {
136 super.setUseFieldNames(useFieldNames);
137 }
138
139 //---------------------------------------------------------------------
140
141 /**
142 * <p>Gets whether to use full detail when the caller doesn't
143 * specify.</p>
144 *
145 * @return the current defaultFullDetail flag
146 */
147 @Override
148 public boolean isDefaultFullDetail() {
149 return super.isDefaultFullDetail();
150 }
151
152 /**
153 * <p>Sets whether to use full detail when the caller doesn't
154 * specify.</p>
155 *
156 * @param defaultFullDetail the new defaultFullDetail flag
157 */
158 @Override
159 public void setDefaultFullDetail(boolean defaultFullDetail) {
160 super.setDefaultFullDetail(defaultFullDetail);
161 }
162
163 //---------------------------------------------------------------------
164
165 /**
166 * <p>Gets whether to output array content detail.</p>
167 *
168 * @return the current array content detail setting
169 */
170 @Override
171 public boolean isArrayContentDetail() {
172 return super.isArrayContentDetail();
173 }
174
175 /**
176 * <p>Sets whether to output array content detail.</p>
177 *
178 * @param arrayContentDetail the new arrayContentDetail flag
179 */
180 @Override
181 public void setArrayContentDetail(boolean arrayContentDetail) {
182 super.setArrayContentDetail(arrayContentDetail);
183 }
184
185 //---------------------------------------------------------------------
186
187 /**
188 * <p>Gets the array start text.</p>
189 *
190 * @return the current array start text
191 */
192 @Override
193 public String getArrayStart() {
194 return super.getArrayStart();
195 }
196
197 /**
198 * <p>Sets the array start text.</p>
199 *
200 * <p><code>null</code> is accepted, but will be converted
201 * to an empty String.</p>
202 *
203 * @param arrayStart the new array start text
204 */
205 @Override
206 public void setArrayStart(String 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 @Override
218 public String getArrayEnd() {
219 return super.getArrayEnd();
220 }
221
222 /**
223 * <p>Sets the array end text.</p>
224 *
225 * <p><code>null</code> is accepted, but will be converted
226 * to an empty String.</p>
227 *
228 * @param arrayEnd the new array end text
229 */
230 @Override
231 public void setArrayEnd(String arrayEnd) {
232 super.setArrayEnd(arrayEnd);
233 }
234
235 //---------------------------------------------------------------------
236
237 /**
238 * <p>Gets the array separator text.</p>
239 *
240 * @return the current array separator text
241 */
242 @Override
243 public String getArraySeparator() {
244 return super.getArraySeparator();
245 }
246
247 /**
248 * <p>Sets the array separator text.</p>
249 *
250 * <p><code>null</code> is accepted, but will be converted
251 * to an empty String.</p>
252 *
253 * @param arraySeparator the new array separator text
254 */
255 @Override
256 public void setArraySeparator(String arraySeparator) {
257 super.setArraySeparator(arraySeparator);
258 }
259
260 //---------------------------------------------------------------------
261
262 /**
263 * <p>Gets the content start text.</p>
264 *
265 * @return the current content start text
266 */
267 @Override
268 public String getContentStart() {
269 return super.getContentStart();
270 }
271
272 /**
273 * <p>Sets the content start text.</p>
274 *
275 * <p><code>null</code> is accepted, but will be converted
276 * to an empty String.</p>
277 *
278 * @param contentStart the new content start text
279 */
280 @Override
281 public void setContentStart(String contentStart) {
282 super.setContentStart(contentStart);
283 }
284
285 //---------------------------------------------------------------------
286
287 /**
288 * <p>Gets the content end text.</p>
289 *
290 * @return the current content end text
291 */
292 @Override
293 public String getContentEnd() {
294 return super.getContentEnd();
295 }
296
297 /**
298 * <p>Sets the content end text.</p>
299 *
300 * <p><code>null</code> is accepted, but will be converted
301 * to an empty String.</p>
302 *
303 * @param contentEnd the new content end text
304 */
305 @Override
306 public void setContentEnd(String contentEnd) {
307 super.setContentEnd(contentEnd);
308 }
309
310 //---------------------------------------------------------------------
311
312 /**
313 * <p>Gets the field name value separator text.</p>
314 *
315 * @return the current field name value separator text
316 */
317 @Override
318 public String getFieldNameValueSeparator() {
319 return super.getFieldNameValueSeparator();
320 }
321
322 /**
323 * <p>Sets the field name value separator text.</p>
324 *
325 * <p><code>null</code> is accepted, but will be converted
326 * to an empty String.</p>
327 *
328 * @param fieldNameValueSeparator the new field name value separator text
329 */
330 @Override
331 public void setFieldNameValueSeparator(String fieldNameValueSeparator) {
332 super.setFieldNameValueSeparator(fieldNameValueSeparator);
333 }
334
335 //---------------------------------------------------------------------
336
337 /**
338 * <p>Gets the field separator text.</p>
339 *
340 * @return the current field separator text
341 */
342 @Override
343 public String getFieldSeparator() {
344 return super.getFieldSeparator();
345 }
346
347 /**
348 * <p>Sets the field separator text.</p>
349 *
350 * <p><code>null</code> is accepted, but will be converted
351 * to an empty String.</p>
352 *
353 * @param fieldSeparator the new field separator text
354 */
355 @Override
356 public void setFieldSeparator(String fieldSeparator) {
357 super.setFieldSeparator(fieldSeparator);
358 }
359
360 //---------------------------------------------------------------------
361
362 /**
363 * <p>Gets whether the field separator should be added at the start
364 * of each buffer.</p>
365 *
366 * @return the fieldSeparatorAtStart flag
367 * @since 2.0
368 */
369 @Override
370 public boolean isFieldSeparatorAtStart() {
371 return super.isFieldSeparatorAtStart();
372 }
373
374 /**
375 * <p>Sets whether the field separator should be added at the start
376 * of each buffer.</p>
377 *
378 * @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
379 * @since 2.0
380 */
381 @Override
382 public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) {
383 super.setFieldSeparatorAtStart(fieldSeparatorAtStart);
384 }
385
386 //---------------------------------------------------------------------
387
388 /**
389 * <p>Gets whether the field separator should be added at the end
390 * of each buffer.</p>
391 *
392 * @return fieldSeparatorAtEnd flag
393 * @since 2.0
394 */
395 @Override
396 public boolean isFieldSeparatorAtEnd() {
397 return super.isFieldSeparatorAtEnd();
398 }
399
400 /**
401 * <p>Sets whether the field separator should be added at the end
402 * of each buffer.</p>
403 *
404 * @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
405 * @since 2.0
406 */
407 @Override
408 public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) {
409 super.setFieldSeparatorAtEnd(fieldSeparatorAtEnd);
410 }
411
412 //---------------------------------------------------------------------
413
414 /**
415 * <p>Gets the text to output when <code>null</code> found.</p>
416 *
417 * @return the current text to output when <code>null</code> found
418 */
419 @Override
420 public String getNullText() {
421 return super.getNullText();
422 }
423
424 /**
425 * <p>Sets the text to output when <code>null</code> found.</p>
426 *
427 * <p><code>null</code> is accepted, but will be converted
428 * to an empty String.</p>
429 *
430 * @param nullText the new text to output when <code>null</code> found
431 */
432 @Override
433 public void setNullText(String nullText) {
434 super.setNullText(nullText);
435 }
436
437 //---------------------------------------------------------------------
438
439 /**
440 * <p>Gets the text to output when a <code>Collection</code>,
441 * <code>Map</code> or <code>Array</code> size is output.</p>
442 *
443 * <p>This is output before the size value.</p>
444 *
445 * @return the current start of size text
446 */
447 @Override
448 public String getSizeStartText() {
449 return super.getSizeStartText();
450 }
451
452 /**
453 * <p>Sets the start text to output when a <code>Collection</code>,
454 * <code>Map</code> or <code>Array</code> size is output.</p>
455 *
456 * <p>This is output before the size value.</p>
457 *
458 * <p><code>null</code> is accepted, but will be converted to
459 * an empty String.</p>
460 *
461 * @param sizeStartText the new start of size text
462 */
463 @Override
464 public void setSizeStartText(String sizeStartText) {
465 super.setSizeStartText(sizeStartText);
466 }
467
468 //---------------------------------------------------------------------
469
470 /**
471 * Gets the end text to output when a <code>Collection</code>,
472 * <code>Map</code> or <code>Array</code> size is output.</p>
473 *
474 * <p>This is output after the size value.</p>
475 *
476 * @return the current end of size text
477 */
478 @Override
479 public String getSizeEndText() {
480 return super.getSizeEndText();
481 }
482
483 /**
484 * <p>Sets the end text to output when a <code>Collection</code>,
485 * <code>Map</code> or <code>Array</code> size is output.</p>
486 *
487 * <p>This is output after the size value.</p>
488 *
489 * <p><code>null</code> is accepted, but will be converted
490 * to an empty String.</p>
491 *
492 * @param sizeEndText the new end of size text
493 */
494 @Override
495 public void setSizeEndText(String sizeEndText) {
496 super.setSizeEndText(sizeEndText);
497 }
498
499 //---------------------------------------------------------------------
500
501 /**
502 * <p>Gets the start text to output when an <code>Object</code> is
503 * output in summary mode.</p>
504 *
505 * <P>This is output before the size value.</p>
506 *
507 * @return the current start of summary text
508 */
509 @Override
510 public String getSummaryObjectStartText() {
511 return super.getSummaryObjectStartText();
512 }
513
514 /**
515 * <p>Sets the start text to output when an <code>Object</code> is
516 * output in summary mode.</p>
517 *
518 * <p>This is output before the size value.</p>
519 *
520 * <p><code>null</code> is accepted, but will be converted to
521 * an empty String.</p>
522 *
523 * @param summaryObjectStartText the new start of summary text
524 */
525 @Override
526 public void setSummaryObjectStartText(String summaryObjectStartText) {
527 super.setSummaryObjectStartText(summaryObjectStartText);
528 }
529
530 //---------------------------------------------------------------------
531
532 /**
533 * <p>Gets the end text to output when an <code>Object</code> is
534 * output in summary mode.</p>
535 *
536 * <p>This is output after the size value.</p>
537 *
538 * @return the current end of summary text
539 */
540 @Override
541 public String getSummaryObjectEndText() {
542 return super.getSummaryObjectEndText();
543 }
544
545 /**
546 * <p>Sets the end text to output when an <code>Object</code> is
547 * output in summary mode.</p>
548 *
549 * <p>This is output after the size value.</p>
550 *
551 * <p><code>null</code> is accepted, but will be converted to
552 * an empty String.</p>
553 *
554 * @param summaryObjectEndText the new end of summary text
555 */
556 @Override
557 public void setSummaryObjectEndText(String summaryObjectEndText) {
558 super.setSummaryObjectEndText(summaryObjectEndText);
559 }
560
561 //---------------------------------------------------------------------
562
563 }