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