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