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