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.html;
014
015import java.lang.annotation.*;
016import java.lang.reflect.*;
017import java.nio.charset.*;
018import java.util.*;
019
020import org.apache.juneau.*;
021import org.apache.juneau.annotation.*;
022import org.apache.juneau.internal.*;
023import org.apache.juneau.json.*;
024import org.apache.juneau.jsonschema.*;
025import org.apache.juneau.utils.*;
026import org.apache.juneau.xml.*;
027
028/**
029 * Serializes POJO metamodels to HTML.
030 *
031 * <h5 class='topic'>Media types</h5>
032 *
033 * Handles <c>Accept</c> types:  <bc>text/html+schema</bc>
034 * <p>
035 * Produces <c>Content-Type</c> types:  <bc>text/html</bc>
036 *
037 * <h5 class='topic'>Description</h5>
038 *
039 * Essentially the same as {@link HtmlDocSerializer}, except serializes the POJO metamodel instead of the model itself.
040 *
041 * <p>
042 * Produces output that describes the POJO metamodel similar to an XML schema document.
043 *
044 * <p>
045 * The easiest way to create instances of this class is through the {@link HtmlSerializer#getSchemaSerializer()},
046 * which will create a schema serializer with the same settings as the originating serializer.
047 *
048 * <h5 class='section'>Notes:</h5><ul>
049 *    <li class='note'>This class is thread safe and reusable.
050 * </ul>
051 *
052 * <h5 class='section'>See Also:</h5><ul>
053 *    <li class='link'><a class="doclink" href="../../../../index.html#jm.HtmlDetails">HTML Details</a>
054
055 * </ul>
056 */
057public final class HtmlSchemaDocSerializer extends HtmlDocSerializer {
058
059   //-----------------------------------------------------------------------------------------------------------------
060   // Static
061   //-----------------------------------------------------------------------------------------------------------------
062
063   /**
064    * Creates a new builder for this object.
065    *
066    * @return A new builder.
067    */
068   public static Builder create() {
069      return new Builder();
070   }
071
072   //-----------------------------------------------------------------------------------------------------------------
073   // Builder
074   //-----------------------------------------------------------------------------------------------------------------
075
076   /**
077    * Builder class.
078    */
079   @FluentSetters
080   public static class Builder extends HtmlDocSerializer.Builder {
081
082      JsonSchemaGenerator.Builder generatorBuilder;
083
084      /**
085       * Constructor, default settings.
086       */
087      protected Builder() {
088         produces("text/html");
089         accept("text/html+schema");
090         generatorBuilder = JsonSchemaGenerator.create().beanContext(beanContext());
091      }
092
093      /**
094       * Copy constructor.
095       *
096       * @param copyFrom The bean to copy from.
097       */
098      protected Builder(HtmlSchemaDocSerializer copyFrom) {
099         super(copyFrom);
100         generatorBuilder = copyFrom.generator.copy().beanContext(beanContext());
101      }
102
103      /**
104       * Copy constructor.
105       *
106       * @param copyFrom The builder to copy from.
107       */
108      protected Builder(Builder copyFrom) {
109         super(copyFrom);
110         generatorBuilder = copyFrom.generatorBuilder.copy().beanContext(beanContext());
111      }
112
113      @Override /* Context.Builder */
114      public Builder copy() {
115         return new Builder(this);
116      }
117
118      @Override /* Context.Builder */
119      public HtmlSchemaDocSerializer build() {
120         return build(HtmlSchemaDocSerializer.class);
121      }
122
123      //-----------------------------------------------------------------------------------------------------------------
124      // Properties
125      //-----------------------------------------------------------------------------------------------------------------
126
127      /**
128       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Add descriptions.
129       *
130       * <p>
131       * Identifies which categories of types that descriptions should be automatically added to generated schemas.
132       * <p>
133       * The description is the result of calling {@link ClassMeta#getFullName()}.
134       *
135       * <h5 class='section'>See Also:</h5><ul>
136       *    <li class='jm'>{@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#addDescriptionsTo(TypeCategory...)}
137       * </ul>
138       *
139       * @param values
140       *    The values to add to this setting.
141       *    <br>The default is an empty string.
142       * @return This object.
143       */
144      @FluentSetter
145      public Builder addDescriptionsTo(TypeCategory...values) {
146         generatorBuilder.addDescriptionsTo(values);
147         return this;
148      }
149
150      /**
151       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Add examples.
152       *
153       * <p>
154       * Identifies which categories of types that examples should be automatically added to generated schemas.
155       * <p>
156       * The examples come from calling {@link ClassMeta#getExample(BeanSession,JsonParserSession)} which in turn gets examples
157       * from the following:
158       * <ul class='javatree'>
159       *    <li class='ja'>{@link Example}
160       *    <li class='ja'>{@link Marshalled#example() Marshalled(example)}
161       * </ul>
162       *
163       * <h5 class='section'>See Also:</h5><ul>
164       *    <li class='jm'>{@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#addExamplesTo(TypeCategory...)}
165       * </ul>
166       *
167       * @param values
168       *    The values to add to this setting.
169       *    <br>The default is an empty string.
170       * @return This object.
171       */
172      @FluentSetter
173      public Builder addExamplesTo(TypeCategory...values) {
174         generatorBuilder.addExamplesTo(values);
175         return this;
176      }
177
178      /**
179       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Allow nested descriptions.
180       *
181       * <p>
182       * Identifies whether nested descriptions are allowed in schema definitions.
183       *
184       * <h5 class='section'>See Also:</h5><ul>
185       *    <li class='jm'>{@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#allowNestedDescriptions()}
186       * </ul>
187       *
188       * @return This object.
189       */
190      @FluentSetter
191      public Builder allowNestedDescriptions() {
192         generatorBuilder.allowNestedDescriptions();
193         return this;
194      }
195
196      /**
197       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Allow nested examples.
198       *
199       * <p>
200       * Identifies whether nested examples are allowed in schema definitions.
201       *
202       * <h5 class='section'>See Also:</h5><ul>
203       *    <li class='jm'>{@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#allowNestedExamples()}
204       * </ul>
205       *
206       * @return This object.
207       */
208      @FluentSetter
209      public Builder allowNestedExamples() {
210         generatorBuilder.allowNestedExamples();
211         return this;
212      }
213
214      /**
215       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Schema definition mapper.
216       *
217       * <p>
218       * Interface to use for converting Bean classes to definition IDs and URIs.
219       * <p>
220       * Used primarily for defining common definition sections for beans in Swagger JSON.
221       * <p>
222       * This setting is ignored if {@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#useBeanDefs()} is not enabled.
223       *
224       * <h5 class='section'>See Also:</h5><ul>
225       *    <li class='jm'>{@link org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder#beanDefMapper(Class)}
226       * </ul>
227       *
228       * @param value
229       *    The new value for this property.
230       *    <br>The default is {@link org.apache.juneau.jsonschema.BasicBeanDefMapper}.
231       * @return This object.
232       */
233      @FluentSetter
234      public Builder beanDefMapper(Class<? extends BeanDefMapper> value) {
235         generatorBuilder.beanDefMapper(value);
236         return this;
237      }
238
239      /**
240       * <i><l>HtmlSchemaSerializer</l> configuration property:&emsp;</i>  Use bean definitions.
241       *
242       * <p>
243       * When enabled, schemas on beans will be serialized as the following:
244       * <p class='bjson'>
245       *    {
246       *       type: <js>'object'</js>,
247       *       <js>'$ref'</js>: <js>'#/definitions/TypeId'</js>
248       *    }
249       * </p>
250       *
251       * @return This object.
252       */
253      @FluentSetter
254      public Builder useBeanDefs() {
255         generatorBuilder.useBeanDefs();
256         return this;
257      }
258
259      // <FluentSetters>
260
261      @Override /* GENERATED - org.apache.juneau.Context.Builder */
262      public Builder annotations(Annotation...values) {
263         super.annotations(values);
264         return this;
265      }
266
267      @Override /* GENERATED - org.apache.juneau.Context.Builder */
268      public Builder apply(AnnotationWorkList work) {
269         super.apply(work);
270         return this;
271      }
272
273      @Override /* GENERATED - org.apache.juneau.Context.Builder */
274      public Builder applyAnnotations(java.lang.Class<?>...fromClasses) {
275         super.applyAnnotations(fromClasses);
276         return this;
277      }
278
279      @Override /* GENERATED - org.apache.juneau.Context.Builder */
280      public Builder applyAnnotations(Method...fromMethods) {
281         super.applyAnnotations(fromMethods);
282         return this;
283      }
284
285      @Override /* GENERATED - org.apache.juneau.Context.Builder */
286      public Builder cache(Cache<HashKey,? extends org.apache.juneau.Context> value) {
287         super.cache(value);
288         return this;
289      }
290
291      @Override /* GENERATED - org.apache.juneau.Context.Builder */
292      public Builder debug() {
293         super.debug();
294         return this;
295      }
296
297      @Override /* GENERATED - org.apache.juneau.Context.Builder */
298      public Builder debug(boolean value) {
299         super.debug(value);
300         return this;
301      }
302
303      @Override /* GENERATED - org.apache.juneau.Context.Builder */
304      public Builder impl(Context value) {
305         super.impl(value);
306         return this;
307      }
308
309      @Override /* GENERATED - org.apache.juneau.Context.Builder */
310      public Builder type(Class<? extends org.apache.juneau.Context> value) {
311         super.type(value);
312         return this;
313      }
314
315      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
316      public Builder beanClassVisibility(Visibility value) {
317         super.beanClassVisibility(value);
318         return this;
319      }
320
321      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
322      public Builder beanConstructorVisibility(Visibility value) {
323         super.beanConstructorVisibility(value);
324         return this;
325      }
326
327      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
328      public Builder beanContext(BeanContext value) {
329         super.beanContext(value);
330         return this;
331      }
332
333      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
334      public Builder beanContext(BeanContext.Builder value) {
335         super.beanContext(value);
336         return this;
337      }
338
339      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
340      public Builder beanDictionary(java.lang.Class<?>...values) {
341         super.beanDictionary(values);
342         return this;
343      }
344
345      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
346      public Builder beanFieldVisibility(Visibility value) {
347         super.beanFieldVisibility(value);
348         return this;
349      }
350
351      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
352      public Builder beanInterceptor(Class<?> on, Class<? extends org.apache.juneau.swap.BeanInterceptor<?>> value) {
353         super.beanInterceptor(on, value);
354         return this;
355      }
356
357      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
358      public Builder beanMapPutReturnsOldValue() {
359         super.beanMapPutReturnsOldValue();
360         return this;
361      }
362
363      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
364      public Builder beanMethodVisibility(Visibility value) {
365         super.beanMethodVisibility(value);
366         return this;
367      }
368
369      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
370      public Builder beanProperties(Map<String,Object> values) {
371         super.beanProperties(values);
372         return this;
373      }
374
375      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
376      public Builder beanProperties(Class<?> beanClass, String properties) {
377         super.beanProperties(beanClass, properties);
378         return this;
379      }
380
381      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
382      public Builder beanProperties(String beanClassName, String properties) {
383         super.beanProperties(beanClassName, properties);
384         return this;
385      }
386
387      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
388      public Builder beanPropertiesExcludes(Map<String,Object> values) {
389         super.beanPropertiesExcludes(values);
390         return this;
391      }
392
393      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
394      public Builder beanPropertiesExcludes(Class<?> beanClass, String properties) {
395         super.beanPropertiesExcludes(beanClass, properties);
396         return this;
397      }
398
399      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
400      public Builder beanPropertiesExcludes(String beanClassName, String properties) {
401         super.beanPropertiesExcludes(beanClassName, properties);
402         return this;
403      }
404
405      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
406      public Builder beanPropertiesReadOnly(Map<String,Object> values) {
407         super.beanPropertiesReadOnly(values);
408         return this;
409      }
410
411      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
412      public Builder beanPropertiesReadOnly(Class<?> beanClass, String properties) {
413         super.beanPropertiesReadOnly(beanClass, properties);
414         return this;
415      }
416
417      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
418      public Builder beanPropertiesReadOnly(String beanClassName, String properties) {
419         super.beanPropertiesReadOnly(beanClassName, properties);
420         return this;
421      }
422
423      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
424      public Builder beanPropertiesWriteOnly(Map<String,Object> values) {
425         super.beanPropertiesWriteOnly(values);
426         return this;
427      }
428
429      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
430      public Builder beanPropertiesWriteOnly(Class<?> beanClass, String properties) {
431         super.beanPropertiesWriteOnly(beanClass, properties);
432         return this;
433      }
434
435      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
436      public Builder beanPropertiesWriteOnly(String beanClassName, String properties) {
437         super.beanPropertiesWriteOnly(beanClassName, properties);
438         return this;
439      }
440
441      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
442      public Builder beansRequireDefaultConstructor() {
443         super.beansRequireDefaultConstructor();
444         return this;
445      }
446
447      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
448      public Builder beansRequireSerializable() {
449         super.beansRequireSerializable();
450         return this;
451      }
452
453      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
454      public Builder beansRequireSettersForGetters() {
455         super.beansRequireSettersForGetters();
456         return this;
457      }
458
459      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
460      public Builder dictionaryOn(Class<?> on, java.lang.Class<?>...values) {
461         super.dictionaryOn(on, values);
462         return this;
463      }
464
465      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
466      public Builder disableBeansRequireSomeProperties() {
467         super.disableBeansRequireSomeProperties();
468         return this;
469      }
470
471      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
472      public Builder disableIgnoreMissingSetters() {
473         super.disableIgnoreMissingSetters();
474         return this;
475      }
476
477      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
478      public Builder disableIgnoreTransientFields() {
479         super.disableIgnoreTransientFields();
480         return this;
481      }
482
483      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
484      public Builder disableIgnoreUnknownNullBeanProperties() {
485         super.disableIgnoreUnknownNullBeanProperties();
486         return this;
487      }
488
489      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
490      public Builder disableInterfaceProxies() {
491         super.disableInterfaceProxies();
492         return this;
493      }
494
495      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
496      public <T> Builder example(Class<T> pojoClass, T o) {
497         super.example(pojoClass, o);
498         return this;
499      }
500
501      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
502      public <T> Builder example(Class<T> pojoClass, String json) {
503         super.example(pojoClass, json);
504         return this;
505      }
506
507      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
508      public Builder findFluentSetters() {
509         super.findFluentSetters();
510         return this;
511      }
512
513      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
514      public Builder findFluentSetters(Class<?> on) {
515         super.findFluentSetters(on);
516         return this;
517      }
518
519      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
520      public Builder ignoreInvocationExceptionsOnGetters() {
521         super.ignoreInvocationExceptionsOnGetters();
522         return this;
523      }
524
525      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
526      public Builder ignoreInvocationExceptionsOnSetters() {
527         super.ignoreInvocationExceptionsOnSetters();
528         return this;
529      }
530
531      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
532      public Builder ignoreUnknownBeanProperties() {
533         super.ignoreUnknownBeanProperties();
534         return this;
535      }
536
537      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
538      public Builder ignoreUnknownEnumValues() {
539         super.ignoreUnknownEnumValues();
540         return this;
541      }
542
543      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
544      public Builder implClass(Class<?> interfaceClass, Class<?> implClass) {
545         super.implClass(interfaceClass, implClass);
546         return this;
547      }
548
549      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
550      public Builder implClasses(Map<Class<?>,Class<?>> values) {
551         super.implClasses(values);
552         return this;
553      }
554
555      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
556      public Builder interfaceClass(Class<?> on, Class<?> value) {
557         super.interfaceClass(on, value);
558         return this;
559      }
560
561      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
562      public Builder interfaces(java.lang.Class<?>...value) {
563         super.interfaces(value);
564         return this;
565      }
566
567      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
568      public Builder locale(Locale value) {
569         super.locale(value);
570         return this;
571      }
572
573      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
574      public Builder mediaType(MediaType value) {
575         super.mediaType(value);
576         return this;
577      }
578
579      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
580      public Builder notBeanClasses(java.lang.Class<?>...values) {
581         super.notBeanClasses(values);
582         return this;
583      }
584
585      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
586      public Builder notBeanPackages(String...values) {
587         super.notBeanPackages(values);
588         return this;
589      }
590
591      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
592      public Builder propertyNamer(Class<? extends org.apache.juneau.PropertyNamer> value) {
593         super.propertyNamer(value);
594         return this;
595      }
596
597      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
598      public Builder propertyNamer(Class<?> on, Class<? extends org.apache.juneau.PropertyNamer> value) {
599         super.propertyNamer(on, value);
600         return this;
601      }
602
603      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
604      public Builder sortProperties() {
605         super.sortProperties();
606         return this;
607      }
608
609      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
610      public Builder sortProperties(java.lang.Class<?>...on) {
611         super.sortProperties(on);
612         return this;
613      }
614
615      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
616      public Builder stopClass(Class<?> on, Class<?> value) {
617         super.stopClass(on, value);
618         return this;
619      }
620
621      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
622      public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction) {
623         super.swap(normalClass, swappedClass, swapFunction);
624         return this;
625      }
626
627      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
628      public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction, ThrowingFunction<S,T> unswapFunction) {
629         super.swap(normalClass, swappedClass, swapFunction, unswapFunction);
630         return this;
631      }
632
633      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
634      public Builder swaps(java.lang.Class<?>...values) {
635         super.swaps(values);
636         return this;
637      }
638
639      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
640      public Builder timeZone(TimeZone value) {
641         super.timeZone(value);
642         return this;
643      }
644
645      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
646      public Builder typeName(Class<?> on, String value) {
647         super.typeName(on, value);
648         return this;
649      }
650
651      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
652      public Builder typePropertyName(String value) {
653         super.typePropertyName(value);
654         return this;
655      }
656
657      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
658      public Builder typePropertyName(Class<?> on, String value) {
659         super.typePropertyName(on, value);
660         return this;
661      }
662
663      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
664      public Builder useEnumNames() {
665         super.useEnumNames();
666         return this;
667      }
668
669      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
670      public Builder useJavaBeanIntrospector() {
671         super.useJavaBeanIntrospector();
672         return this;
673      }
674
675      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
676      public Builder detectRecursions() {
677         super.detectRecursions();
678         return this;
679      }
680
681      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
682      public Builder detectRecursions(boolean value) {
683         super.detectRecursions(value);
684         return this;
685      }
686
687      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
688      public Builder ignoreRecursions() {
689         super.ignoreRecursions();
690         return this;
691      }
692
693      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
694      public Builder ignoreRecursions(boolean value) {
695         super.ignoreRecursions(value);
696         return this;
697      }
698
699      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
700      public Builder initialDepth(int value) {
701         super.initialDepth(value);
702         return this;
703      }
704
705      @Override /* GENERATED - org.apache.juneau.BeanTraverseContext.Builder */
706      public Builder maxDepth(int value) {
707         super.maxDepth(value);
708         return this;
709      }
710
711      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
712      public Builder accept(String value) {
713         super.accept(value);
714         return this;
715      }
716
717      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
718      public Builder addBeanTypes() {
719         super.addBeanTypes();
720         return this;
721      }
722
723      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
724      public Builder addBeanTypes(boolean value) {
725         super.addBeanTypes(value);
726         return this;
727      }
728
729      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
730      public Builder addRootType() {
731         super.addRootType();
732         return this;
733      }
734
735      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
736      public Builder addRootType(boolean value) {
737         super.addRootType(value);
738         return this;
739      }
740
741      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
742      public Builder keepNullProperties() {
743         super.keepNullProperties();
744         return this;
745      }
746
747      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
748      public Builder keepNullProperties(boolean value) {
749         super.keepNullProperties(value);
750         return this;
751      }
752
753      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
754      public Builder listener(Class<? extends org.apache.juneau.serializer.SerializerListener> value) {
755         super.listener(value);
756         return this;
757      }
758
759      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
760      public Builder produces(String value) {
761         super.produces(value);
762         return this;
763      }
764
765      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
766      public Builder sortCollections() {
767         super.sortCollections();
768         return this;
769      }
770
771      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
772      public Builder sortCollections(boolean value) {
773         super.sortCollections(value);
774         return this;
775      }
776
777      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
778      public Builder sortMaps() {
779         super.sortMaps();
780         return this;
781      }
782
783      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
784      public Builder sortMaps(boolean value) {
785         super.sortMaps(value);
786         return this;
787      }
788
789      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
790      public Builder trimEmptyCollections() {
791         super.trimEmptyCollections();
792         return this;
793      }
794
795      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
796      public Builder trimEmptyCollections(boolean value) {
797         super.trimEmptyCollections(value);
798         return this;
799      }
800
801      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
802      public Builder trimEmptyMaps() {
803         super.trimEmptyMaps();
804         return this;
805      }
806
807      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
808      public Builder trimEmptyMaps(boolean value) {
809         super.trimEmptyMaps(value);
810         return this;
811      }
812
813      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
814      public Builder trimStrings() {
815         super.trimStrings();
816         return this;
817      }
818
819      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
820      public Builder trimStrings(boolean value) {
821         super.trimStrings(value);
822         return this;
823      }
824
825      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
826      public Builder uriContext(UriContext value) {
827         super.uriContext(value);
828         return this;
829      }
830
831      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
832      public Builder uriRelativity(UriRelativity value) {
833         super.uriRelativity(value);
834         return this;
835      }
836
837      @Override /* GENERATED - org.apache.juneau.serializer.Serializer.Builder */
838      public Builder uriResolution(UriResolution value) {
839         super.uriResolution(value);
840         return this;
841      }
842
843      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
844      public Builder fileCharset(Charset value) {
845         super.fileCharset(value);
846         return this;
847      }
848
849      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
850      public Builder maxIndent(int value) {
851         super.maxIndent(value);
852         return this;
853      }
854
855      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
856      public Builder quoteChar(char value) {
857         super.quoteChar(value);
858         return this;
859      }
860
861      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
862      public Builder quoteCharOverride(char value) {
863         super.quoteCharOverride(value);
864         return this;
865      }
866
867      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
868      public Builder sq() {
869         super.sq();
870         return this;
871      }
872
873      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
874      public Builder streamCharset(Charset value) {
875         super.streamCharset(value);
876         return this;
877      }
878
879      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
880      public Builder useWhitespace() {
881         super.useWhitespace();
882         return this;
883      }
884
885      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
886      public Builder useWhitespace(boolean value) {
887         super.useWhitespace(value);
888         return this;
889      }
890
891      @Override /* GENERATED - org.apache.juneau.serializer.WriterSerializer.Builder */
892      public Builder ws() {
893         super.ws();
894         return this;
895      }
896
897      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
898      public Builder addBeanTypesXml() {
899         super.addBeanTypesXml();
900         return this;
901      }
902
903      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
904      public Builder addBeanTypesXml(boolean value) {
905         super.addBeanTypesXml(value);
906         return this;
907      }
908
909      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
910      public Builder addNamespaceUrisToRoot() {
911         super.addNamespaceUrisToRoot();
912         return this;
913      }
914
915      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
916      public Builder addNamespaceUrisToRoot(boolean value) {
917         super.addNamespaceUrisToRoot(value);
918         return this;
919      }
920
921      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
922      public Builder defaultNamespace(Namespace value) {
923         super.defaultNamespace(value);
924         return this;
925      }
926
927      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
928      public Builder disableAutoDetectNamespaces() {
929         super.disableAutoDetectNamespaces();
930         return this;
931      }
932
933      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
934      public Builder disableAutoDetectNamespaces(boolean value) {
935         super.disableAutoDetectNamespaces(value);
936         return this;
937      }
938
939      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
940      public Builder enableNamespaces() {
941         super.enableNamespaces();
942         return this;
943      }
944
945      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
946      public Builder enableNamespaces(boolean value) {
947         super.enableNamespaces(value);
948         return this;
949      }
950
951      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
952      public Builder namespaces(Namespace...values) {
953         super.namespaces(values);
954         return this;
955      }
956
957      @Override /* GENERATED - org.apache.juneau.xml.XmlSerializer.Builder */
958      public Builder ns() {
959         super.ns();
960         return this;
961      }
962
963      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
964      public Builder addBeanTypesHtml() {
965         super.addBeanTypesHtml();
966         return this;
967      }
968
969      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
970      public Builder addBeanTypesHtml(boolean value) {
971         super.addBeanTypesHtml(value);
972         return this;
973      }
974
975      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
976      public Builder addKeyValueTableHeaders() {
977         super.addKeyValueTableHeaders();
978         return this;
979      }
980
981      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
982      public Builder addKeyValueTableHeaders(boolean value) {
983         super.addKeyValueTableHeaders(value);
984         return this;
985      }
986
987      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
988      public Builder disableDetectLabelParameters() {
989         super.disableDetectLabelParameters();
990         return this;
991      }
992
993      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
994      public Builder disableDetectLabelParameters(boolean value) {
995         super.disableDetectLabelParameters(value);
996         return this;
997      }
998
999      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
1000      public Builder disableDetectLinksInStrings() {
1001         super.disableDetectLinksInStrings();
1002         return this;
1003      }
1004
1005      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
1006      public Builder disableDetectLinksInStrings(boolean value) {
1007         super.disableDetectLinksInStrings(value);
1008         return this;
1009      }
1010
1011      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
1012      public Builder labelParameter(String value) {
1013         super.labelParameter(value);
1014         return this;
1015      }
1016
1017      @Override /* GENERATED - org.apache.juneau.html.HtmlSerializer.Builder */
1018      public Builder uriAnchorText(AnchorText value) {
1019         super.uriAnchorText(value);
1020         return this;
1021      }
1022
1023      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1024      public Builder aside(String...value) {
1025         super.aside(value);
1026         return this;
1027      }
1028
1029      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1030      public Builder asideFloat(AsideFloat value) {
1031         super.asideFloat(value);
1032         return this;
1033      }
1034
1035      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1036      public Builder footer(String...value) {
1037         super.footer(value);
1038         return this;
1039      }
1040
1041      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1042      public Builder head(String...value) {
1043         super.head(value);
1044         return this;
1045      }
1046
1047      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1048      public Builder header(String...value) {
1049         super.header(value);
1050         return this;
1051      }
1052
1053      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1054      public Builder nav(String...value) {
1055         super.nav(value);
1056         return this;
1057      }
1058
1059      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1060      public Builder navlinks(String...value) {
1061         super.navlinks(value);
1062         return this;
1063      }
1064
1065      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1066      public Builder noResultsMessage(String value) {
1067         super.noResultsMessage(value);
1068         return this;
1069      }
1070
1071      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1072      public Builder nowrap() {
1073         super.nowrap();
1074         return this;
1075      }
1076
1077      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1078      public Builder nowrap(boolean value) {
1079         super.nowrap(value);
1080         return this;
1081      }
1082
1083      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1084      public Builder script(String...value) {
1085         super.script(value);
1086         return this;
1087      }
1088
1089      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1090      public Builder style(String...value) {
1091         super.style(value);
1092         return this;
1093      }
1094
1095      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1096      public Builder stylesheet(String...value) {
1097         super.stylesheet(value);
1098         return this;
1099      }
1100
1101      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1102      public Builder template(Class<? extends org.apache.juneau.html.HtmlDocTemplate> value) {
1103         super.template(value);
1104         return this;
1105      }
1106
1107      @Override /* GENERATED - org.apache.juneau.html.HtmlDocSerializer.Builder */
1108      @SuppressWarnings("unchecked")
1109      public Builder widgets(java.lang.Class<? extends org.apache.juneau.html.HtmlWidget>...values) {
1110         super.widgets(values);
1111         return this;
1112      }
1113
1114      // </FluentSetters>
1115   }
1116
1117   //-----------------------------------------------------------------------------------------------------------------
1118   // Instance
1119   //-----------------------------------------------------------------------------------------------------------------
1120
1121   final JsonSchemaGenerator generator;
1122
1123   /**
1124    * Constructor.
1125    *
1126    * @param builder
1127    *    The builder for this object.
1128    */
1129   public HtmlSchemaDocSerializer(HtmlDocSerializer.Builder builder) {
1130      super(builder.detectRecursions().ignoreRecursions());
1131
1132      generator = JsonSchemaGenerator.create().beanContext(getBeanContext()).build();
1133   }
1134
1135   @Override /* Context */
1136   public Builder copy() {
1137      return new Builder(this);
1138   }
1139
1140   @Override /* Context */
1141   public HtmlSchemaDocSerializerSession.Builder createSession() {
1142      return HtmlSchemaDocSerializerSession.create(this);
1143   }
1144
1145   @Override /* Context */
1146   public HtmlSchemaDocSerializerSession getSession() {
1147      return createSession().build();
1148   }
1149
1150   JsonSchemaGenerator getGenerator() {
1151      return generator;
1152   }
1153}