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