| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StandardToStringStyle |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.apache.commons.lang3.builder; | |
| 18 | ||
| 19 | /** | |
| 20 | * <p>Works with {@link ToStringBuilder} to create a <code>toString</code>.</p> | |
| 21 | * | |
| 22 | * <p>This class is intended to be used as a singleton. | |
| 23 | * There is no need to instantiate a new style each time. | |
| 24 | * Simply instantiate the class once, customize the values as required, and | |
| 25 | * store the result in a public static final variable for the rest of the | |
| 26 | * program to access.</p> | |
| 27 | * | |
| 28 | * @since 1.0 | |
| 29 | * @version $Id: StandardToStringStyle.java 1436768 2013-01-22 07:07:42Z ggregory $ | |
| 30 | */ | |
| 31 | public class StandardToStringStyle extends ToStringStyle { | |
| 32 | ||
| 33 | /** | |
| 34 | * Required for serialization support. | |
| 35 | * | |
| 36 | * @see java.io.Serializable | |
| 37 | */ | |
| 38 | private static final long serialVersionUID = 1L; | |
| 39 | ||
| 40 | /** | |
| 41 | * <p>Constructor.</p> | |
| 42 | */ | |
| 43 | public StandardToStringStyle() { | |
| 44 | 1 | super(); |
| 45 | 1 | } |
| 46 | ||
| 47 | //--------------------------------------------------------------------- | |
| 48 | ||
| 49 | /** | |
| 50 | * <p>Gets whether to use the class name.</p> | |
| 51 | * | |
| 52 | * @return the current useClassName flag | |
| 53 | */ | |
| 54 | @Override | |
| 55 | public boolean isUseClassName() { // NOPMD as this is implementing the abstract class | |
| 56 | 0 | return super.isUseClassName(); |
| 57 | } | |
| 58 | ||
| 59 | /** | |
| 60 | * <p>Sets whether to use the class name.</p> | |
| 61 | * | |
| 62 | * @param useClassName the new useClassName flag | |
| 63 | */ | |
| 64 | @Override | |
| 65 | public void setUseClassName(final boolean useClassName) { // NOPMD as this is implementing the abstract class | |
| 66 | 0 | super.setUseClassName(useClassName); |
| 67 | 0 | } |
| 68 | ||
| 69 | //--------------------------------------------------------------------- | |
| 70 | ||
| 71 | /** | |
| 72 | * <p>Gets whether to output short or long class names.</p> | |
| 73 | * | |
| 74 | * @return the current useShortClassName flag | |
| 75 | * @since 2.0 | |
| 76 | */ | |
| 77 | @Override | |
| 78 | public boolean isUseShortClassName() { // NOPMD as this is implementing the abstract class | |
| 79 | 0 | return super.isUseShortClassName(); |
| 80 | } | |
| 81 | ||
| 82 | /** | |
| 83 | * <p>Sets whether to output short or long class names.</p> | |
| 84 | * | |
| 85 | * @param useShortClassName the new useShortClassName flag | |
| 86 | * @since 2.0 | |
| 87 | */ | |
| 88 | @Override | |
| 89 | public void setUseShortClassName(final boolean useShortClassName) { // NOPMD as this is implementing the abstract class | |
| 90 | 1 | super.setUseShortClassName(useShortClassName); |
| 91 | 1 | } |
| 92 | ||
| 93 | //--------------------------------------------------------------------- | |
| 94 | ||
| 95 | /** | |
| 96 | * <p>Gets whether to use the identity hash code.</p> | |
| 97 | * @return the current useIdentityHashCode flag | |
| 98 | */ | |
| 99 | @Override | |
| 100 | public boolean isUseIdentityHashCode() { // NOPMD as this is implementing the abstract class | |
| 101 | 34 | 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 | 1 | super.setUseIdentityHashCode(useIdentityHashCode); |
| 112 | 1 | } |
| 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 | 0 | 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 | 0 | super.setUseFieldNames(useFieldNames); |
| 134 | 0 | } |
| 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 | 0 | 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 | 0 | super.setDefaultFullDetail(defaultFullDetail); |
| 158 | 0 | } |
| 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 | 0 | 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 | 0 | super.setArrayContentDetail(arrayContentDetail); |
| 180 | 0 | } |
| 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 | 0 | 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 | 1 | super.setArrayStart(arrayStart); |
| 205 | 1 | } |
| 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 | 0 | 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 | 1 | super.setArrayEnd(arrayEnd); |
| 230 | 1 | } |
| 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 | 0 | 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 | 1 | super.setArraySeparator(arraySeparator); |
| 255 | 1 | } |
| 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 | 0 | 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 | 0 | super.setContentStart(contentStart); |
| 280 | 0 | } |
| 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 | 0 | 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 | 0 | super.setContentEnd(contentEnd); |
| 305 | 0 | } |
| 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 | 0 | 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 | 0 | super.setFieldNameValueSeparator(fieldNameValueSeparator); |
| 330 | 0 | } |
| 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 | 0 | 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 | 0 | super.setFieldSeparator(fieldSeparator); |
| 355 | 0 | } |
| 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 | 0 | 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 | 0 | super.setFieldSeparatorAtStart(fieldSeparatorAtStart); |
| 381 | 0 | } |
| 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 | 0 | 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 | 0 | super.setFieldSeparatorAtEnd(fieldSeparatorAtEnd); |
| 407 | 0 | } |
| 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 | 0 | 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 | 1 | super.setNullText(nullText); |
| 432 | 1 | } |
| 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 | 0 | 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 | 1 | super.setSizeStartText(sizeStartText); |
| 463 | 1 | } |
| 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 | 0 | 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 | 1 | super.setSizeEndText(sizeEndText); |
| 494 | 1 | } |
| 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 | 0 | 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 | 1 | super.setSummaryObjectStartText(summaryObjectStartText); |
| 525 | 1 | } |
| 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 | 0 | 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 | 1 | super.setSummaryObjectEndText(summaryObjectEndText); |
| 556 | 1 | } |
| 557 | ||
| 558 | //--------------------------------------------------------------------- | |
| 559 | ||
| 560 | } |