001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.plaintext; 014 015import java.lang.annotation.*; 016import java.lang.reflect.*; 017import java.nio.charset.*; 018import java.util.*; 019import java.util.concurrent.*; 020 021import org.apache.juneau.*; 022import org.apache.juneau.internal.*; 023import org.apache.juneau.serializer.*; 024import org.apache.juneau.swap.*; 025import org.apache.juneau.utils.*; 026 027/** 028 * Serializes POJOs to plain text using just the <c>toString()</c> method on the serialized object. 029 * 030 * <h5 class='topic'>Media types</h5> 031 * 032 * Handles <c>Accept</c> types: <bc>text/plain</bc> 033 * <p> 034 * Produces <c>Content-Type</c> types: <bc>text/plain</bc> 035 * 036 * <h5 class='topic'>Description</h5> 037 * 038 * Essentially converts POJOs to plain text using the <c>toString()</c> method. 039 * 040 * <p> 041 * Also serializes objects using a transform if the object class has an {@link ObjectSwap ObjectSwap<?,String>} 042 * transform defined on it. 043 * 044 * <h5 class='section'>Notes:</h5><ul> 045 * <li class='note'>This class is thread safe and reusable. 046 * </ul> 047 * 048 * <h5 class='section'>See Also:</h5><ul> 049 050 * </ul> 051 */ 052public class PlainTextSerializer extends WriterSerializer implements PlainTextMetaProvider { 053 054 //------------------------------------------------------------------------------------------------------------------- 055 // Static 056 //------------------------------------------------------------------------------------------------------------------- 057 058 /** Default serializer, all default settings.*/ 059 public static final PlainTextSerializer DEFAULT = new PlainTextSerializer(create()); 060 061 /** 062 * Creates a new builder for this object. 063 * 064 * @return A new builder. 065 */ 066 public static Builder create() { 067 return new Builder(); 068 } 069 070 //------------------------------------------------------------------------------------------------------------------- 071 // Builder 072 //------------------------------------------------------------------------------------------------------------------- 073 074 /** 075 * Builder class. 076 */ 077 @FluentSetters 078 public static class Builder extends WriterSerializer.Builder { 079 080 private static final Cache<HashKey,PlainTextSerializer> CACHE = Cache.of(HashKey.class, PlainTextSerializer.class).build(); 081 082 /** 083 * Constructor, default settings. 084 */ 085 protected Builder() { 086 produces("text/plain"); 087 } 088 089 /** 090 * Copy constructor. 091 * 092 * @param copyFrom The bean to copy from. 093 */ 094 protected Builder(PlainTextSerializer copyFrom) { 095 super(copyFrom); 096 } 097 098 /** 099 * Copy constructor. 100 * 101 * @param copyFrom The builder to copy from. 102 */ 103 protected Builder(Builder copyFrom) { 104 super(copyFrom); 105 } 106 107 @Override /* Context.Builder */ 108 public Builder copy() { 109 return new Builder(this); 110 } 111 112 @Override /* Context.Builder */ 113 public PlainTextSerializer build() { 114 return cache(CACHE).build(PlainTextSerializer.class); 115 } 116 117 @Override /* Context.Builder */ 118 public HashKey hashKey() { 119 return super.hashKey(); 120 } 121 122 //----------------------------------------------------------------------------------------------------------------- 123 // Properties 124 //----------------------------------------------------------------------------------------------------------------- 125 126 // <FluentSetters> 127 128 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 129 public Builder annotations(Annotation...values) { 130 super.annotations(values); 131 return this; 132 } 133 134 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 135 public Builder apply(AnnotationWorkList work) { 136 super.apply(work); 137 return this; 138 } 139 140 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 141 public Builder applyAnnotations(java.lang.Class<?>...fromClasses) { 142 super.applyAnnotations(fromClasses); 143 return this; 144 } 145 146 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 147 public Builder applyAnnotations(Method...fromMethods) { 148 super.applyAnnotations(fromMethods); 149 return this; 150 } 151 152 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 153 public Builder cache(Cache<HashKey,? extends org.apache.juneau.Context> value) { 154 super.cache(value); 155 return this; 156 } 157 158 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 159 public Builder debug() { 160 super.debug(); 161 return this; 162 } 163 164 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 165 public Builder debug(boolean value) { 166 super.debug(value); 167 return this; 168 } 169 170 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 171 public Builder impl(Context value) { 172 super.impl(value); 173 return this; 174 } 175 176 @Override /* GENERATED - org.apache.juneau.Context.Builder */ 177 public Builder type(Class<? extends org.apache.juneau.Context> value) { 178 super.type(value); 179 return this; 180 } 181 182 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 183 public Builder beanClassVisibility(Visibility value) { 184 super.beanClassVisibility(value); 185 return this; 186 } 187 188 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 189 public Builder beanConstructorVisibility(Visibility value) { 190 super.beanConstructorVisibility(value); 191 return this; 192 } 193 194 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 195 public Builder beanContext(BeanContext value) { 196 super.beanContext(value); 197 return this; 198 } 199 200 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 201 public Builder beanContext(BeanContext.Builder value) { 202 super.beanContext(value); 203 return this; 204 } 205 206 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 207 public Builder beanDictionary(java.lang.Class<?>...values) { 208 super.beanDictionary(values); 209 return this; 210 } 211 212 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 213 public Builder beanFieldVisibility(Visibility value) { 214 super.beanFieldVisibility(value); 215 return this; 216 } 217 218 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 219 public Builder beanInterceptor(Class<?> on, Class<? extends org.apache.juneau.swap.BeanInterceptor<?>> value) { 220 super.beanInterceptor(on, value); 221 return this; 222 } 223 224 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 225 public Builder beanMapPutReturnsOldValue() { 226 super.beanMapPutReturnsOldValue(); 227 return this; 228 } 229 230 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 231 public Builder beanMethodVisibility(Visibility value) { 232 super.beanMethodVisibility(value); 233 return this; 234 } 235 236 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 237 public Builder beanProperties(Map<String,Object> values) { 238 super.beanProperties(values); 239 return this; 240 } 241 242 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 243 public Builder beanProperties(Class<?> beanClass, String properties) { 244 super.beanProperties(beanClass, properties); 245 return this; 246 } 247 248 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 249 public Builder beanProperties(String beanClassName, String properties) { 250 super.beanProperties(beanClassName, properties); 251 return this; 252 } 253 254 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 255 public Builder beanPropertiesExcludes(Map<String,Object> values) { 256 super.beanPropertiesExcludes(values); 257 return this; 258 } 259 260 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 261 public Builder beanPropertiesExcludes(Class<?> beanClass, String properties) { 262 super.beanPropertiesExcludes(beanClass, properties); 263 return this; 264 } 265 266 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 267 public Builder beanPropertiesExcludes(String beanClassName, String properties) { 268 super.beanPropertiesExcludes(beanClassName, properties); 269 return this; 270 } 271 272 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 273 public Builder beanPropertiesReadOnly(Map<String,Object> values) { 274 super.beanPropertiesReadOnly(values); 275 return this; 276 } 277 278 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 279 public Builder beanPropertiesReadOnly(Class<?> beanClass, String properties) { 280 super.beanPropertiesReadOnly(beanClass, properties); 281 return this; 282 } 283 284 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 285 public Builder beanPropertiesReadOnly(String beanClassName, String properties) { 286 super.beanPropertiesReadOnly(beanClassName, properties); 287 return this; 288 } 289 290 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 291 public Builder beanPropertiesWriteOnly(Map<String,Object> values) { 292 super.beanPropertiesWriteOnly(values); 293 return this; 294 } 295 296 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 297 public Builder beanPropertiesWriteOnly(Class<?> beanClass, String properties) { 298 super.beanPropertiesWriteOnly(beanClass, properties); 299 return this; 300 } 301 302 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 303 public Builder beanPropertiesWriteOnly(String beanClassName, String properties) { 304 super.beanPropertiesWriteOnly(beanClassName, properties); 305 return this; 306 } 307 308 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 309 public Builder beansRequireDefaultConstructor() { 310 super.beansRequireDefaultConstructor(); 311 return this; 312 } 313 314 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 315 public Builder beansRequireSerializable() { 316 super.beansRequireSerializable(); 317 return this; 318 } 319 320 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 321 public Builder beansRequireSettersForGetters() { 322 super.beansRequireSettersForGetters(); 323 return this; 324 } 325 326 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 327 public Builder dictionaryOn(Class<?> on, java.lang.Class<?>...values) { 328 super.dictionaryOn(on, values); 329 return this; 330 } 331 332 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 333 public Builder disableBeansRequireSomeProperties() { 334 super.disableBeansRequireSomeProperties(); 335 return this; 336 } 337 338 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 339 public Builder disableIgnoreMissingSetters() { 340 super.disableIgnoreMissingSetters(); 341 return this; 342 } 343 344 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 345 public Builder disableIgnoreTransientFields() { 346 super.disableIgnoreTransientFields(); 347 return this; 348 } 349 350 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 351 public Builder disableIgnoreUnknownNullBeanProperties() { 352 super.disableIgnoreUnknownNullBeanProperties(); 353 return this; 354 } 355 356 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 357 public Builder disableInterfaceProxies() { 358 super.disableInterfaceProxies(); 359 return this; 360 } 361 362 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 363 public <T> Builder example(Class<T> pojoClass, T o) { 364 super.example(pojoClass, o); 365 return this; 366 } 367 368 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 369 public <T> Builder example(Class<T> pojoClass, String json) { 370 super.example(pojoClass, json); 371 return this; 372 } 373 374 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 375 public Builder findFluentSetters() { 376 super.findFluentSetters(); 377 return this; 378 } 379 380 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 381 public Builder findFluentSetters(Class<?> on) { 382 super.findFluentSetters(on); 383 return this; 384 } 385 386 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 387 public Builder ignoreInvocationExceptionsOnGetters() { 388 super.ignoreInvocationExceptionsOnGetters(); 389 return this; 390 } 391 392 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 393 public Builder ignoreInvocationExceptionsOnSetters() { 394 super.ignoreInvocationExceptionsOnSetters(); 395 return this; 396 } 397 398 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 399 public Builder ignoreUnknownBeanProperties() { 400 super.ignoreUnknownBeanProperties(); 401 return this; 402 } 403 404 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 405 public Builder ignoreUnknownEnumValues() { 406 super.ignoreUnknownEnumValues(); 407 return this; 408 } 409 410 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 411 public Builder implClass(Class<?> interfaceClass, Class<?> implClass) { 412 super.implClass(interfaceClass, implClass); 413 return this; 414 } 415 416 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 417 public Builder implClasses(Map<Class<?>,Class<?>> values) { 418 super.implClasses(values); 419 return this; 420 } 421 422 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 423 public Builder interfaceClass(Class<?> on, Class<?> value) { 424 super.interfaceClass(on, value); 425 return this; 426 } 427 428 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 429 public Builder interfaces(java.lang.Class<?>...value) { 430 super.interfaces(value); 431 return this; 432 } 433 434 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 435 public Builder locale(Locale value) { 436 super.locale(value); 437 return this; 438 } 439 440 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 441 public Builder mediaType(MediaType value) { 442 super.mediaType(value); 443 return this; 444 } 445 446 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 447 public Builder notBeanClasses(java.lang.Class<?>...values) { 448 super.notBeanClasses(values); 449 return this; 450 } 451 452 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 453 public Builder notBeanPackages(String...values) { 454 super.notBeanPackages(values); 455 return this; 456 } 457 458 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 459 public Builder propertyNamer(Class<? extends org.apache.juneau.PropertyNamer> value) { 460 super.propertyNamer(value); 461 return this; 462 } 463 464 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 465 public Builder propertyNamer(Class<?> on, Class<? extends org.apache.juneau.PropertyNamer> value) { 466 super.propertyNamer(on, value); 467 return this; 468 } 469 470 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 471 public Builder sortProperties() { 472 super.sortProperties(); 473 return this; 474 } 475 476 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 477 public Builder sortProperties(java.lang.Class<?>...on) { 478 super.sortProperties(on); 479 return this; 480 } 481 482 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 483 public Builder stopClass(Class<?> on, Class<?> value) { 484 super.stopClass(on, value); 485 return this; 486 } 487 488 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 489 public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction) { 490 super.swap(normalClass, swappedClass, swapFunction); 491 return this; 492 } 493 494 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 495 public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction, ThrowingFunction<S,T> unswapFunction) { 496 super.swap(normalClass, swappedClass, swapFunction, unswapFunction); 497 return this; 498 } 499 500 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 501 public Builder swaps(java.lang.Class<?>...values) { 502 super.swaps(values); 503 return this; 504 } 505 506 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 507 public Builder timeZone(TimeZone value) { 508 super.timeZone(value); 509 return this; 510 } 511 512 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 513 public Builder typeName(Class<?> on, String value) { 514 super.typeName(on, value); 515 return this; 516 } 517 518 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 519 public Builder typePropertyName(String value) { 520 super.typePropertyName(value); 521 return this; 522 } 523 524 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 525 public Builder typePropertyName(Class<?> on, String value) { 526 super.typePropertyName(on, value); 527 return this; 528 } 529 530 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 531 public Builder useEnumNames() { 532 super.useEnumNames(); 533 return this; 534 } 535 536 @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */ 537 public Builder useJavaBeanIntrospector() { 538 super.useJavaBeanIntrospector(); 539 return this; 540 } 541 542 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 543 public Builder detectRecursions() { 544 super.detectRecursions(); 545 return this; 546 } 547 548 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 549 public Builder detectRecursions(boolean value) { 550 super.detectRecursions(value); 551 return this; 552 } 553 554 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 555 public Builder ignoreRecursions() { 556 super.ignoreRecursions(); 557 return this; 558 } 559 560 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 561 public Builder ignoreRecursions(boolean value) { 562 super.ignoreRecursions(value); 563 return this; 564 } 565 566 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 567 public Builder initialDepth(int value) { 568 super.initialDepth(value); 569 return this; 570 } 571 572 @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */ 573 public Builder maxDepth(int value) { 574 super.maxDepth(value); 575 return this; 576 } 577 578 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 579 public Builder accept(String value) { 580 super.accept(value); 581 return this; 582 } 583 584 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 585 public Builder addBeanTypes() { 586 super.addBeanTypes(); 587 return this; 588 } 589 590 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 591 public Builder addBeanTypes(boolean value) { 592 super.addBeanTypes(value); 593 return this; 594 } 595 596 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 597 public Builder addRootType() { 598 super.addRootType(); 599 return this; 600 } 601 602 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 603 public Builder addRootType(boolean value) { 604 super.addRootType(value); 605 return this; 606 } 607 608 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 609 public Builder keepNullProperties() { 610 super.keepNullProperties(); 611 return this; 612 } 613 614 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 615 public Builder keepNullProperties(boolean value) { 616 super.keepNullProperties(value); 617 return this; 618 } 619 620 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 621 public Builder listener(Class<? extends org.apache.juneau.serializer.SerializerListener> value) { 622 super.listener(value); 623 return this; 624 } 625 626 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 627 public Builder produces(String value) { 628 super.produces(value); 629 return this; 630 } 631 632 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 633 public Builder sortCollections() { 634 super.sortCollections(); 635 return this; 636 } 637 638 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 639 public Builder sortCollections(boolean value) { 640 super.sortCollections(value); 641 return this; 642 } 643 644 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 645 public Builder sortMaps() { 646 super.sortMaps(); 647 return this; 648 } 649 650 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 651 public Builder sortMaps(boolean value) { 652 super.sortMaps(value); 653 return this; 654 } 655 656 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 657 public Builder trimEmptyCollections() { 658 super.trimEmptyCollections(); 659 return this; 660 } 661 662 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 663 public Builder trimEmptyCollections(boolean value) { 664 super.trimEmptyCollections(value); 665 return this; 666 } 667 668 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 669 public Builder trimEmptyMaps() { 670 super.trimEmptyMaps(); 671 return this; 672 } 673 674 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 675 public Builder trimEmptyMaps(boolean value) { 676 super.trimEmptyMaps(value); 677 return this; 678 } 679 680 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 681 public Builder trimStrings() { 682 super.trimStrings(); 683 return this; 684 } 685 686 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 687 public Builder trimStrings(boolean value) { 688 super.trimStrings(value); 689 return this; 690 } 691 692 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 693 public Builder uriContext(UriContext value) { 694 super.uriContext(value); 695 return this; 696 } 697 698 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 699 public Builder uriRelativity(UriRelativity value) { 700 super.uriRelativity(value); 701 return this; 702 } 703 704 @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */ 705 public Builder uriResolution(UriResolution value) { 706 super.uriResolution(value); 707 return this; 708 } 709 710 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 711 public Builder fileCharset(Charset value) { 712 super.fileCharset(value); 713 return this; 714 } 715 716 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 717 public Builder maxIndent(int value) { 718 super.maxIndent(value); 719 return this; 720 } 721 722 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 723 public Builder quoteChar(char value) { 724 super.quoteChar(value); 725 return this; 726 } 727 728 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 729 public Builder quoteCharOverride(char value) { 730 super.quoteCharOverride(value); 731 return this; 732 } 733 734 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 735 public Builder sq() { 736 super.sq(); 737 return this; 738 } 739 740 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 741 public Builder streamCharset(Charset value) { 742 super.streamCharset(value); 743 return this; 744 } 745 746 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 747 public Builder useWhitespace() { 748 super.useWhitespace(); 749 return this; 750 } 751 752 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 753 public Builder useWhitespace(boolean value) { 754 super.useWhitespace(value); 755 return this; 756 } 757 758 @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */ 759 public Builder ws() { 760 super.ws(); 761 return this; 762 } 763 764 // </FluentSetters> 765 } 766 767 //------------------------------------------------------------------------------------------------------------------- 768 // Instance 769 //------------------------------------------------------------------------------------------------------------------- 770 771 private final Map<ClassMeta<?>,PlainTextClassMeta> plainTextClassMetas = new ConcurrentHashMap<>(); 772 private final Map<BeanPropertyMeta,PlainTextBeanPropertyMeta> plainTextBeanPropertyMetas = new ConcurrentHashMap<>(); 773 774 /** 775 * Constructor. 776 * 777 * @param builder 778 * The builder for this object. 779 */ 780 public PlainTextSerializer(Builder builder) { 781 super(builder); 782 } 783 784 785 @Override /* Context */ 786 public Builder copy() { 787 return new Builder(this); 788 } 789 790 @Override /* Context */ 791 public PlainTextSerializerSession.Builder createSession() { 792 return PlainTextSerializerSession.create(this); 793 } 794 795 @Override /* Context */ 796 public PlainTextSerializerSession getSession() { 797 return createSession().build(); 798 } 799 800 //----------------------------------------------------------------------------------------------------------------- 801 // Extended metadata 802 //----------------------------------------------------------------------------------------------------------------- 803 804 @Override /* PlainTextMetaProvider */ 805 public PlainTextClassMeta getPlainTextClassMeta(ClassMeta<?> cm) { 806 PlainTextClassMeta m = plainTextClassMetas.get(cm); 807 if (m == null) { 808 m = new PlainTextClassMeta(cm, this); 809 plainTextClassMetas.put(cm, m); 810 } 811 return m; 812 } 813 814 @Override /* PlainTextMetaProvider */ 815 public PlainTextBeanPropertyMeta getPlainTextBeanPropertyMeta(BeanPropertyMeta bpm) { 816 if (bpm == null) 817 return PlainTextBeanPropertyMeta.DEFAULT; 818 PlainTextBeanPropertyMeta m = plainTextBeanPropertyMetas.get(bpm); 819 if (m == null) { 820 m = new PlainTextBeanPropertyMeta(bpm.getDelegateFor(), this); 821 plainTextBeanPropertyMetas.put(bpm, m); 822 } 823 return m; 824 } 825}