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