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