| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>JsonSchemaSerializer.Builder (Apache Juneau 9.0.0)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="description" content="declaration: package: org.apache.juneau.json, class: JsonSchemaSerializer, class: Builder"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../script-dir/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../script-dir/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../script-dir/jquery-3.4.1.js"></script> |
| <script type="text/javascript" src="../../../../script-dir/jquery-ui.js"></script> |
| </head> |
| <body class="class-declaration"> |
| <script type="text/javascript">var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10,"i56":10,"i57":10,"i58":10,"i59":10,"i60":10,"i61":10,"i62":10,"i63":10,"i64":10,"i65":10,"i66":10,"i67":10,"i68":10,"i69":10,"i70":10,"i71":10,"i72":10,"i73":10,"i74":10,"i75":10,"i76":10,"i77":10,"i78":10,"i79":10,"i80":10,"i81":10,"i82":10,"i83":10,"i84":10,"i85":10,"i86":10,"i87":10,"i88":10,"i89":10,"i90":10,"i91":10,"i92":10,"i93":10,"i94":10,"i95":10,"i96":10,"i97":10,"i98":10,"i99":10,"i100":10,"i101":10,"i102":10,"i103":10,"i104":10,"i105":10,"i106":10,"i107":10,"i108":10,"i109":10,"i110":10,"i111":10,"i112":10,"i113":10,"i114":10,"i115":10,"i116":10,"i117":10,"i118":10,"i119":10,"i120":10,"i121":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flexBox"> |
| <header role="banner" class="flexHeader"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="navListSearch"><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <div class="skipNav"><a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| </nav> |
| </header> |
| <div class="flexContent"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.juneau.json</a></div> |
| <h1 title="Class JsonSchemaSerializer.Builder" class="title">Class JsonSchemaSerializer.Builder</h1> |
| </div> |
| <div class="contentContainer"> |
| <div class="inheritance" title="Inheritance Tree">java.lang.Object |
| <div class="inheritance"><a href="../Context.Builder.html" title="class in org.apache.juneau">org.apache.juneau.Context.Builder</a> |
| <div class="inheritance"><a href="../BeanContextable.Builder.html" title="class in org.apache.juneau">org.apache.juneau.BeanContextable.Builder</a> |
| <div class="inheritance"><a href="../BeanTraverseContext.Builder.html" title="class in org.apache.juneau">org.apache.juneau.BeanTraverseContext.Builder</a> |
| <div class="inheritance"><a href="../serializer/Serializer.Builder.html" title="class in org.apache.juneau.serializer">org.apache.juneau.serializer.Serializer.Builder</a> |
| <div class="inheritance"><a href="../serializer/WriterSerializer.Builder.html" title="class in org.apache.juneau.serializer">org.apache.juneau.serializer.WriterSerializer.Builder</a> |
| <div class="inheritance"><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">org.apache.juneau.json.JsonSerializer.Builder</a> |
| <div class="inheritance">org.apache.juneau.json.JsonSchemaSerializer.Builder</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <section class="description"> |
| <dl> |
| <dt>Enclosing class:</dt> |
| <dd><a href="JsonSchemaSerializer.html" title="class in org.apache.juneau.json">JsonSchemaSerializer</a></dd> |
| </dl> |
| <hr> |
| <pre>public static class <a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.html#line.129">JsonSchemaSerializer.Builder</a> |
| extends <a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></pre> |
| <div class="block">Builder class.</div> |
| </section> |
| <section class="summary"> |
| <ul class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <li class="blockList"> |
| <section class="constructorSummary"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h2>Constructor Summary</h2> |
| <div class="memberSummary"> |
| <table> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <thead> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colSecond" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">Builder</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Constructor, default settings.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.juneau.json.JsonSchemaSerializer)">Builder</a></span>​(<a href="JsonSchemaSerializer.html" title="class in org.apache.juneau.json">JsonSchemaSerializer</a> copyFrom)</code></th> |
| <td class="colLast"> |
| <div class="block">Copy constructor.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.apache.juneau.json.JsonSchemaSerializer.Builder)">Builder</a></span>​(<a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a> copyFrom)</code></th> |
| <td class="colLast"> |
| <div class="block">Copy constructor.</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li class="blockList"> |
| <section class="methodSummary"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h2>Method Summary</h2> |
| <div class="memberSummary"> |
| <div role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="memberSummary_tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="activeTableTab">All Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t2" class="tableTab" onclick="show(2);">Instance Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t4" class="tableTab" onclick="show(8);">Concrete Methods</button></div> |
| <div id="memberSummary_tabpanel" role="tabpanel"> |
| <table aria-labelledby="t0"> |
| <thead> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="altColor" id="i0"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#accept(java.lang.String)">accept</a></span>​(java.lang.String value)</code></th> |
| <td class="colLast"> |
| <div class="block">Specifies the accept media types that the serializer can handle.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i1"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addBeanTypes()">addBeanTypes</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Add <js>"_type"</js> properties when needed.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i2"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addBeanTypes(boolean)">addBeanTypes</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#addBeanTypes()"><code>Serializer.Builder.addBeanTypes()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i3"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addBeanTypesJson()">addBeanTypesJson</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Add <js>"_type"</js> properties when needed.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i4"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addBeanTypesJson(boolean)">addBeanTypesJson</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#addBeanTypesJson()"><code>JsonSerializer.Builder.addBeanTypesJson()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i5"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addDescriptionsTo(org.apache.juneau.jsonschema.TypeCategory...)">addDescriptionsTo</a></span>​(<a href="../jsonschema/TypeCategory.html" title="enum in org.apache.juneau.jsonschema">TypeCategory</a>... values)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Add descriptions.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i6"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addExamplesTo(org.apache.juneau.jsonschema.TypeCategory...)">addExamplesTo</a></span>​(<a href="../jsonschema/TypeCategory.html" title="enum in org.apache.juneau.jsonschema">TypeCategory</a>... values)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Add examples.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i7"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addRootType()">addRootType</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Add type attribute to root nodes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i8"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addRootType(boolean)">addRootType</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#addRootType()"><code>Serializer.Builder.addRootType()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i9"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#allowNestedDescriptions()">allowNestedDescriptions</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Allow nested descriptions.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i10"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#allowNestedExamples()">allowNestedExamples</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Allow nested examples.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i11"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#annotations(java.lang.annotation.Annotation...)">annotations</a></span>​(java.lang.annotation.Annotation... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Defines annotations to apply to specific classes and methods.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i12"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#apply(org.apache.juneau.AnnotationWorkList)">apply</a></span>​(<a href="../AnnotationWorkList.html" title="class in org.apache.juneau">AnnotationWorkList</a> work)</code></th> |
| <td class="colLast"> |
| <div class="block">Applies a set of applied to this builder.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i13"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#applyAnnotations(java.lang.Class...)">applyAnnotations</a></span>​(java.lang.Class<?>... fromClasses)</code></th> |
| <td class="colLast"> |
| <div class="block">Applies any of the various <ja>@XConfig</ja> annotations on the specified class to this context.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i14"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#applyAnnotations(java.lang.reflect.Method...)">applyAnnotations</a></span>​(java.lang.reflect.Method... fromMethods)</code></th> |
| <td class="colLast"> |
| <div class="block">Applies any of the various <ja>@XConfig</ja> annotations on the specified method to this context.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i15"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanClassVisibility(org.apache.juneau.Visibility)">beanClassVisibility</a></span>​(<a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Minimum bean class visibility.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i16"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanConstructorVisibility(org.apache.juneau.Visibility)">beanConstructorVisibility</a></span>​(<a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Minimum bean constructor visibility.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i17"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanContext(org.apache.juneau.BeanContext)">beanContext</a></span>​(<a href="../BeanContext.html" title="class in org.apache.juneau">BeanContext</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Specifies an already-instantiated bean context to use.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i18"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanContext(org.apache.juneau.BeanContext.Builder)">beanContext</a></span>​(<a href="../BeanContext.Builder.html" title="class in org.apache.juneau">BeanContext.Builder</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Overrides the bean context builder.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i19"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanDefMapper(java.lang.Class)">beanDefMapper</a></span>​(java.lang.Class<? extends <a href="../jsonschema/BeanDefMapper.html" title="interface in org.apache.juneau.jsonschema">BeanDefMapper</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Schema definition mapper.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i20"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanDictionary(java.lang.Class...)">beanDictionary</a></span>​(java.lang.Class<?>... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean dictionary.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i21"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanFieldVisibility(org.apache.juneau.Visibility)">beanFieldVisibility</a></span>​(<a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Minimum bean field visibility.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i22"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanInterceptor(java.lang.Class,java.lang.Class)">beanInterceptor</a></span>​(java.lang.Class<?> on, |
| java.lang.Class<? extends <a href="../swap/BeanInterceptor.html" title="class in org.apache.juneau.swap">BeanInterceptor</a><?>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean interceptor.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i23"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanMapPutReturnsOldValue()">beanMapPutReturnsOldValue</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">BeanMap.put() returns old property value.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i24"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanMethodVisibility(org.apache.juneau.Visibility)">beanMethodVisibility</a></span>​(<a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Minimum bean method visibility.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i25"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanProperties(java.lang.Class,java.lang.String)">beanProperties</a></span>​(java.lang.Class<?> beanClass, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property includes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i26"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanProperties(java.lang.String,java.lang.String)">beanProperties</a></span>​(java.lang.String beanClassName, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property includes.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i27"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanProperties(java.util.Map)">beanProperties</a></span>​(java.util.Map<java.lang.String,​java.lang.Object> values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property includes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i28"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesExcludes(java.lang.Class,java.lang.String)">beanPropertiesExcludes</a></span>​(java.lang.Class<?> beanClass, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property excludes.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i29"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesExcludes(java.lang.String,java.lang.String)">beanPropertiesExcludes</a></span>​(java.lang.String beanClassName, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property excludes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i30"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesExcludes(java.util.Map)">beanPropertiesExcludes</a></span>​(java.util.Map<java.lang.String,​java.lang.Object> values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property excludes.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i31"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesReadOnly(java.lang.Class,java.lang.String)">beanPropertiesReadOnly</a></span>​(java.lang.Class<?> beanClass, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Read-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i32"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesReadOnly(java.lang.String,java.lang.String)">beanPropertiesReadOnly</a></span>​(java.lang.String beanClassName, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Read-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i33"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesReadOnly(java.util.Map)">beanPropertiesReadOnly</a></span>​(java.util.Map<java.lang.String,​java.lang.Object> values)</code></th> |
| <td class="colLast"> |
| <div class="block">Read-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i34"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesWriteOnly(java.lang.Class,java.lang.String)">beanPropertiesWriteOnly</a></span>​(java.lang.Class<?> beanClass, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Write-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i35"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesWriteOnly(java.lang.String,java.lang.String)">beanPropertiesWriteOnly</a></span>​(java.lang.String beanClassName, |
| java.lang.String properties)</code></th> |
| <td class="colLast"> |
| <div class="block">Write-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i36"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beanPropertiesWriteOnly(java.util.Map)">beanPropertiesWriteOnly</a></span>​(java.util.Map<java.lang.String,​java.lang.Object> values)</code></th> |
| <td class="colLast"> |
| <div class="block">Write-only bean properties.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i37"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beansRequireDefaultConstructor()">beansRequireDefaultConstructor</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Beans require no-arg constructors.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i38"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beansRequireSerializable()">beansRequireSerializable</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Beans require Serializable interface.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i39"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#beansRequireSettersForGetters()">beansRequireSettersForGetters</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Beans require setters for getters.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i40"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.html" title="class in org.apache.juneau.json">JsonSchemaSerializer</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#build()">build</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Build the object.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i41"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#cache(org.apache.juneau.internal.Cache)">cache</a></span>​(<a href="../internal/Cache.html" title="class in org.apache.juneau.internal">Cache</a><<a href="../utils/HashKey.html" title="class in org.apache.juneau.utils">HashKey</a>,​? extends <a href="../Context.html" title="class in org.apache.juneau">Context</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Specifies a cache to use for hashkey-based caching.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i42"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#copy()">copy</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Copy creator.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i43"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#debug()">debug</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>Context</l> configuration property: </i> Debug mode.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i44"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#debug(boolean)">debug</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../Context.Builder.html#debug()"><code>Context.Builder.debug()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i45"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#detectRecursions()">detectRecursions</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Automatically detect POJO recursions.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i46"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#detectRecursions(boolean)">detectRecursions</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../BeanTraverseContext.Builder.html#detectRecursions()"><code>BeanTraverseContext.Builder.detectRecursions()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i47"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#dictionaryOn(java.lang.Class,java.lang.Class...)">dictionaryOn</a></span>​(java.lang.Class<?> on, |
| java.lang.Class<?>... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean dictionary.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i48"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disableBeansRequireSomeProperties()">disableBeansRequireSomeProperties</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Beans don't require at least one property.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i49"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disableIgnoreMissingSetters()">disableIgnoreMissingSetters</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Don't silently ignore missing setters.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i50"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disableIgnoreTransientFields()">disableIgnoreTransientFields</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Don't ignore transient fields.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i51"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disableIgnoreUnknownNullBeanProperties()">disableIgnoreUnknownNullBeanProperties</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Don't ignore unknown properties with null values.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i52"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disableInterfaceProxies()">disableInterfaceProxies</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Don't use interface proxies.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i53"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#escapeSolidus()">escapeSolidus</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Prefix solidus <js>'/'</js> characters with escapes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i54"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#escapeSolidus(boolean)">escapeSolidus</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#escapeSolidus()"><code>JsonSerializer.Builder.escapeSolidus()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i55"> |
| <td class="colFirst"><code><T> <a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#example(java.lang.Class,java.lang.String)">example</a></span>​(java.lang.Class<T> pojoClass, |
| java.lang.String json)</code></th> |
| <td class="colLast"> |
| <div class="block">POJO example.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i56"> |
| <td class="colFirst"><code><T> <a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#example(java.lang.Class,T)">example</a></span>​(java.lang.Class<T> pojoClass, |
| T o)</code></th> |
| <td class="colLast"> |
| <div class="block">POJO example.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i57"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fileCharset(java.nio.charset.Charset)">fileCharset</a></span>​(java.nio.charset.Charset value)</code></th> |
| <td class="colLast"> |
| <div class="block">File charset.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i58"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findFluentSetters()">findFluentSetters</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Find fluent setters.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i59"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findFluentSetters(java.lang.Class)">findFluentSetters</a></span>​(java.lang.Class<?> on)</code></th> |
| <td class="colLast"> |
| <div class="block">Find fluent setters.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i60"> |
| <td class="colFirst"><code><a href="../utils/HashKey.html" title="class in org.apache.juneau.utils">HashKey</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hashKey()">hashKey</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the hashkey of this builder.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i61"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreInvocationExceptionsOnGetters()">ignoreInvocationExceptionsOnGetters</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Ignore invocation errors on getters.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i62"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreInvocationExceptionsOnSetters()">ignoreInvocationExceptionsOnSetters</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Ignore invocation errors on setters.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i63"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreRecursions()">ignoreRecursions</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Ignore recursion errors.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i64"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreRecursions(boolean)">ignoreRecursions</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../BeanTraverseContext.Builder.html#ignoreRecursions()"><code>BeanTraverseContext.Builder.ignoreRecursions()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i65"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreUnknownBeanProperties()">ignoreUnknownBeanProperties</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Ignore unknown properties.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i66"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ignoreUnknownEnumValues()">ignoreUnknownEnumValues</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Ignore unknown enum values.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i67"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#impl(org.apache.juneau.Context)">impl</a></span>​(<a href="../Context.html" title="class in org.apache.juneau">Context</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Specifies a pre-instantiated bean for the <a href="../Context.Builder.html#build()"><code>Context.Builder.build()</code></a> method to return.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i68"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#implClass(java.lang.Class,java.lang.Class)">implClass</a></span>​(java.lang.Class<?> interfaceClass, |
| java.lang.Class<?> implClass)</code></th> |
| <td class="colLast"> |
| <div class="block">Implementation classes.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i69"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#implClasses(java.util.Map)">implClasses</a></span>​(java.util.Map<java.lang.Class<?>,​java.lang.Class<?>> values)</code></th> |
| <td class="colLast"> |
| <div class="block">Implementation classes.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i70"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initialDepth(int)">initialDepth</a></span>​(int value)</code></th> |
| <td class="colLast"> |
| <div class="block">Initial depth.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i71"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#interfaceClass(java.lang.Class,java.lang.Class)">interfaceClass</a></span>​(java.lang.Class<?> on, |
| java.lang.Class<?> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Identifies a class to be used as the interface class for the specified class and all subclasses.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i72"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#interfaces(java.lang.Class...)">interfaces</a></span>​(java.lang.Class<?>... value)</code></th> |
| <td class="colLast"> |
| <div class="block">Identifies a set of interfaces.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i73"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#json5()">json5</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Simple JSON mode and single quote.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i74"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#keepNullProperties()">keepNullProperties</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Don't trim null bean property values.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i75"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#keepNullProperties(boolean)">keepNullProperties</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#keepNullProperties()"><code>Serializer.Builder.keepNullProperties()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i76"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#listener(java.lang.Class)">listener</a></span>​(java.lang.Class<? extends <a href="../serializer/SerializerListener.html" title="class in org.apache.juneau.serializer">SerializerListener</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Serializer listener.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i77"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#locale(java.util.Locale)">locale</a></span>​(java.util.Locale value)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>Context</l> configuration property: </i> Locale.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i78"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#maxDepth(int)">maxDepth</a></span>​(int value)</code></th> |
| <td class="colLast"> |
| <div class="block">Max traversal depth.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i79"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#maxIndent(int)">maxIndent</a></span>​(int value)</code></th> |
| <td class="colLast"> |
| <div class="block">Maximum indentation.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i80"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#mediaType(org.apache.juneau.MediaType)">mediaType</a></span>​(<a href="../MediaType.html" title="class in org.apache.juneau">MediaType</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>Context</l> configuration property: </i> Media type.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i81"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#notBeanClasses(java.lang.Class...)">notBeanClasses</a></span>​(java.lang.Class<?>... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean class exclusions.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i82"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#notBeanPackages(java.lang.String...)">notBeanPackages</a></span>​(java.lang.String... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean package exclusions.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i83"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#produces(java.lang.String)">produces</a></span>​(java.lang.String value)</code></th> |
| <td class="colLast"> |
| <div class="block">Specifies the media type that this serializer produces.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i84"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#propertyNamer(java.lang.Class,java.lang.Class)">propertyNamer</a></span>​(java.lang.Class<?> on, |
| java.lang.Class<? extends <a href="../PropertyNamer.html" title="interface in org.apache.juneau">PropertyNamer</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property namer</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i85"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#propertyNamer(java.lang.Class)">propertyNamer</a></span>​(java.lang.Class<? extends <a href="../PropertyNamer.html" title="interface in org.apache.juneau">PropertyNamer</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean property namer</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i86"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#quoteChar(char)">quoteChar</a></span>​(char value)</code></th> |
| <td class="colLast"> |
| <div class="block">Quote character.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i87"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#quoteCharOverride(char)">quoteCharOverride</a></span>​(char value)</code></th> |
| <td class="colLast"> |
| <div class="block">Quote character override.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i88"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#simpleAttrs()">simpleAttrs</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Simple JSON attributes mode.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i89"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#simpleAttrs(boolean)">simpleAttrs</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#simpleAttrs()"><code>JsonSerializer.Builder.simpleAttrs()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i90"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortCollections()">sortCollections</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Sort arrays and collections alphabetically.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i91"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortCollections(boolean)">sortCollections</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#sortCollections()"><code>Serializer.Builder.sortCollections()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i92"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortMaps()">sortMaps</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Sort maps alphabetically.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i93"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortMaps(boolean)">sortMaps</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#sortMaps()"><code>Serializer.Builder.sortMaps()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i94"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortProperties()">sortProperties</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Sort bean properties.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i95"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sortProperties(java.lang.Class...)">sortProperties</a></span>​(java.lang.Class<?>... on)</code></th> |
| <td class="colLast"> |
| <div class="block">Sort bean properties.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i96"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#sq()">sq</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Quote character.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i97"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#stopClass(java.lang.Class,java.lang.Class)">stopClass</a></span>​(java.lang.Class<?> on, |
| java.lang.Class<?> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Identifies a stop class for the annotated class.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i98"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#streamCharset(java.nio.charset.Charset)">streamCharset</a></span>​(java.nio.charset.Charset value)</code></th> |
| <td class="colLast"> |
| <div class="block">Output stream charset.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i99"> |
| <td class="colFirst"><code><T,​ |
| S> <a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction)">swap</a></span>​(java.lang.Class<T> normalClass, |
| java.lang.Class<S> swappedClass, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><T,​S> swapFunction)</code></th> |
| <td class="colLast"> |
| <div class="block">A shortcut for defining a <a href="../swap/FunctionalSwap.html" title="class in org.apache.juneau.swap"><code>FunctionalSwap</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i100"> |
| <td class="colFirst"><code><T,​ |
| S> <a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction,org.apache.juneau.utils.ThrowingFunction)">swap</a></span>​(java.lang.Class<T> normalClass, |
| java.lang.Class<S> swappedClass, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><T,​S> swapFunction, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><S,​T> unswapFunction)</code></th> |
| <td class="colLast"> |
| <div class="block">A shortcut for defining a <a href="../swap/FunctionalSwap.html" title="class in org.apache.juneau.swap"><code>FunctionalSwap</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i101"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#swaps(java.lang.Class...)">swaps</a></span>​(java.lang.Class<?>... values)</code></th> |
| <td class="colLast"> |
| <div class="block">Java object swaps.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i102"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#timeZone(java.util.TimeZone)">timeZone</a></span>​(java.util.TimeZone value)</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>Context</l> configuration property: </i> TimeZone.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i103"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimEmptyCollections()">trimEmptyCollections</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Trim empty lists and arrays.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i104"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimEmptyCollections(boolean)">trimEmptyCollections</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimEmptyCollections()"><code>Serializer.Builder.trimEmptyCollections()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i105"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimEmptyMaps()">trimEmptyMaps</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Trim empty maps.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i106"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimEmptyMaps(boolean)">trimEmptyMaps</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimEmptyMaps()"><code>Serializer.Builder.trimEmptyMaps()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i107"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimStrings()">trimStrings</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Trim strings.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i108"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#trimStrings(boolean)">trimStrings</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimStrings()"><code>Serializer.Builder.trimStrings()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i109"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#type(java.lang.Class)">type</a></span>​(java.lang.Class<? extends <a href="../Context.html" title="class in org.apache.juneau">Context</a>> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Associates a context class with this builder.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i110"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#typeName(java.lang.Class,java.lang.String)">typeName</a></span>​(java.lang.Class<?> on, |
| java.lang.String value)</code></th> |
| <td class="colLast"> |
| <div class="block">An identifying name for this class.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i111"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#typePropertyName(java.lang.Class,java.lang.String)">typePropertyName</a></span>​(java.lang.Class<?> on, |
| java.lang.String value)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean type property name.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i112"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#typePropertyName(java.lang.String)">typePropertyName</a></span>​(java.lang.String value)</code></th> |
| <td class="colLast"> |
| <div class="block">Bean type property name.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i113"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#uriContext(org.apache.juneau.UriContext)">uriContext</a></span>​(<a href="../UriContext.html" title="class in org.apache.juneau">UriContext</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">URI context bean.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i114"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#uriRelativity(org.apache.juneau.UriRelativity)">uriRelativity</a></span>​(<a href="../UriRelativity.html" title="enum in org.apache.juneau">UriRelativity</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">URI relativity.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i115"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#uriResolution(org.apache.juneau.UriResolution)">uriResolution</a></span>​(<a href="../UriResolution.html" title="enum in org.apache.juneau">UriResolution</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">URI resolution.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i116"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useBeanDefs()">useBeanDefs</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Use bean definitions.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i117"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useEnumNames()">useEnumNames</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Use enum names.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i118"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useJavaBeanIntrospector()">useJavaBeanIntrospector</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Use Java Introspector.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i119"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useWhitespace()">useWhitespace</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Use whitespace.</div> |
| </td> |
| </tr> |
| <tr class="altColor" id="i120"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#useWhitespace(boolean)">useWhitespace</a></span>​(boolean value)</code></th> |
| <td class="colLast"> |
| <div class="block">Same as <a href="../serializer/WriterSerializer.Builder.html#useWhitespace()"><code>WriterSerializer.Builder.useWhitespace()</code></a> but allows you to explicitly specify the value.</div> |
| </td> |
| </tr> |
| <tr class="rowColor" id="i121"> |
| <td class="colFirst"><code><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ws()">ws</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Use whitespace.</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="inheritedList"> |
| <h3>Methods inherited from class org.apache.juneau.serializer.<a href="../serializer/Serializer.Builder.html" title="class in org.apache.juneau.serializer">Serializer.Builder</a></h3> |
| <a id="methods.inherited.from.class.org.apache.juneau.serializer.Serializer.Builder"> |
| <!-- --> |
| </a><code><a href="../serializer/Serializer.Builder.html#getAccept()">getAccept</a>, <a href="../serializer/Serializer.Builder.html#getProduces()">getProduces</a></code></div> |
| <div class="inheritedList"> |
| <h3>Methods inherited from class org.apache.juneau.<a href="../BeanContextable.Builder.html" title="class in org.apache.juneau">BeanContextable.Builder</a></h3> |
| <a id="methods.inherited.from.class.org.apache.juneau.BeanContextable.Builder"> |
| <!-- --> |
| </a><code><a href="../BeanContextable.Builder.html#beanContext()">beanContext</a>, <a href="../BeanContextable.Builder.html#beanContext(java.util.function.Consumer)">beanContext</a></code></div> |
| <div class="inheritedList"> |
| <h3>Methods inherited from class org.apache.juneau.<a href="../Context.Builder.html" title="class in org.apache.juneau">Context.Builder</a></h3> |
| <a id="methods.inherited.from.class.org.apache.juneau.Context.Builder"> |
| <!-- --> |
| </a><code><a href="../Context.Builder.html#apply(java.lang.Class,java.util.function.Consumer)">apply</a>, <a href="../Context.Builder.html#build(java.lang.Class)">build</a>, <a href="../Context.Builder.html#canApply(org.apache.juneau.AnnotationWorkList)">canApply</a>, <a href="../Context.Builder.html#env(java.lang.String)">env</a>, <a href="../Context.Builder.html#env(java.lang.String,T)">env</a>, <a href="../Context.Builder.html#getApplied()">getApplied</a>, <a href="../Context.Builder.html#getType()">getType</a>, <a href="../Context.Builder.html#isDebug()">isDebug</a>, <a href="../Context.Builder.html#registerBuilders(java.lang.Object...)">registerBuilders</a></code></div> |
| <div class="inheritedList"> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a><code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <li class="blockList"> |
| <section class="constructorDetails"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h2>Constructor Details</h2> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="<init>()">Builder</a></h3> |
| <div class="memberSignature"><span class="modifiers">protected</span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.139">Builder</a></span>()</div> |
| <div class="block">Constructor, default settings.</div> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="<init>(org.apache.juneau.json.JsonSchemaSerializer)">Builder</a></h3> |
| <div class="memberSignature"><span class="modifiers">protected</span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.151">Builder</a></span>​(<span class="arguments"><a href="JsonSchemaSerializer.html" title="class in org.apache.juneau.json">JsonSchemaSerializer</a> copyFrom)</span></div> |
| <div class="block">Copy constructor.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>copyFrom</code> - The bean to copy from.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="<init>(org.apache.juneau.json.JsonSchemaSerializer.Builder)">Builder</a></h3> |
| <div class="memberSignature"><span class="modifiers">protected</span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.161">Builder</a></span>​(<span class="arguments"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a> copyFrom)</span></div> |
| <div class="block">Copy constructor.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>copyFrom</code> - The builder to copy from.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li class="blockList"> |
| <section class="methodDetails"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h2>Method Details</h2> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="copy()">copy</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.166">copy</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#copy()">Context.Builder</a></code></span></div> |
| <div class="block">Copy creator.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#copy()">copy</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A new mutable copy of this builder.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="build()">build</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.html" title="class in org.apache.juneau.json">JsonSchemaSerializer</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.171">build</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#build()">Context.Builder</a></code></span></div> |
| <div class="block">Build the object.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#build()">build</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The built object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="hashKey()">hashKey</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="../utils/HashKey.html" title="class in org.apache.juneau.utils">HashKey</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.176">hashKey</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#hashKey()">Context.Builder</a></code></span></div> |
| <div class="block">Returns the hashkey of this builder. |
| |
| <p> |
| Used to return previously instantiated context beans that have matching hashkeys. |
| The <a href="../utils/HashKey.html" title="class in org.apache.juneau.utils"><code>HashKey</code></a> object is suitable for use as a hashmap key of a map of context beans. |
| A context bean is considered equivalent if the <a href="../utils/HashKey.html#equals(java.lang.Object)"><code>HashKey.equals(Object)</code></a> method is the same.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#hashKey()">hashKey</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The hashkey of this builder.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addDescriptionsTo(org.apache.juneau.jsonschema.TypeCategory...)">addDescriptionsTo</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.205">addDescriptionsTo</a></span>​(<span class="arguments"><a href="../jsonschema/TypeCategory.html" title="enum in org.apache.juneau.jsonschema">TypeCategory</a>... values)</span></div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Add descriptions. |
| |
| <p> |
| Identifies which categories of types that descriptions should be automatically added to generated schemas. |
| <p> |
| The description is the result of calling <a href="../ClassMeta.html#getFullName()"><code>ClassMeta.getFullName()</code></a>. |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../jsonschema/JsonSchemaGenerator.Builder.html#addDescriptionsTo(org.apache.juneau.jsonschema.TypeCategory...)"><code>JsonSchemaGenerator.Builder.addDescriptionsTo(TypeCategory...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting. |
| <br>The default is an empty string.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addExamplesTo(org.apache.juneau.jsonschema.TypeCategory...)">addExamplesTo</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.233">addExamplesTo</a></span>​(<span class="arguments"><a href="../jsonschema/TypeCategory.html" title="enum in org.apache.juneau.jsonschema">TypeCategory</a>... values)</span></div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Add examples. |
| |
| <p> |
| Identifies which categories of types that examples should be automatically added to generated schemas. |
| <p> |
| The examples come from calling <a href="../ClassMeta.html#getExample(org.apache.juneau.BeanSession,org.apache.juneau.json.JsonParserSession)"><code>ClassMeta.getExample(BeanSession,JsonParserSession)</code></a> which in turn gets examples |
| from the following: |
| <ul class='javatree'> |
| <li class='ja'><a href="../annotation/Example.html" title="annotation in org.apache.juneau.annotation"><code>Example</code></a> |
| <li class='ja'><a href="../annotation/Marshalled.html#example()"><code>Marshalled(example)</code></a> |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../jsonschema/JsonSchemaGenerator.Builder.html#addExamplesTo(org.apache.juneau.jsonschema.TypeCategory...)"><code>JsonSchemaGenerator.Builder.addExamplesTo(TypeCategory...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting. |
| <br>The default is an empty string.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="allowNestedDescriptions()">allowNestedDescriptions</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.251">allowNestedDescriptions</a></span>()</div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Allow nested descriptions. |
| |
| <p> |
| Identifies whether nested descriptions are allowed in schema definitions. |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../jsonschema/JsonSchemaGenerator.Builder.html#allowNestedDescriptions()"><code>JsonSchemaGenerator.Builder.allowNestedDescriptions()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="allowNestedExamples()">allowNestedExamples</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.269">allowNestedExamples</a></span>()</div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Allow nested examples. |
| |
| <p> |
| Identifies whether nested examples are allowed in schema definitions. |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../jsonschema/JsonSchemaGenerator.Builder.html#allowNestedExamples()"><code>JsonSchemaGenerator.Builder.allowNestedExamples()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanDefMapper(java.lang.Class)">beanDefMapper</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.294">beanDefMapper</a></span>​(<span class="arguments">java.lang.Class<? extends <a href="../jsonschema/BeanDefMapper.html" title="interface in org.apache.juneau.jsonschema">BeanDefMapper</a>> value)</span></div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Schema definition mapper. |
| |
| <p> |
| Interface to use for converting Bean classes to definition IDs and URIs. |
| <p> |
| Used primarily for defining common definition sections for beans in Swagger JSON. |
| <p> |
| This setting is ignored if <a href="../jsonschema/JsonSchemaGenerator.Builder.html#useBeanDefs()"><code>JsonSchemaGenerator.Builder.useBeanDefs()</code></a> is not enabled. |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../jsonschema/JsonSchemaGenerator.Builder.html#beanDefMapper(java.lang.Class)"><code>JsonSchemaGenerator.Builder.beanDefMapper(Class)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <a href="../jsonschema/BasicBeanDefMapper.html" title="class in org.apache.juneau.jsonschema"><code>BasicBeanDefMapper</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="useBeanDefs()">useBeanDefs</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.314">useBeanDefs</a></span>()</div> |
| <div class="block"><i><l>JsonSchemaSerializer</l> configuration property: </i> Use bean definitions. |
| |
| <p> |
| When enabled, schemas on beans will be serialized as the following: |
| <p class='bjson'> |
| { |
| type: <js>'object'</js>, |
| <js>'$ref'</js>: <js>'#/definitions/TypeId'</js> |
| } |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="annotations(java.lang.annotation.Annotation...)">annotations</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.322">annotations</a></span>​(<span class="arguments">java.lang.annotation.Annotation... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#annotations(java.lang.annotation.Annotation...)">Context.Builder</a></code></span></div> |
| <div class="block">Defines annotations to apply to specific classes and methods. |
| |
| <p> |
| Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods. |
| Useful in cases where you want to use the functionality of the annotation on beans and bean properties but |
| do not have access to the code to do so. |
| |
| <p> |
| As a rule, any Juneau annotation with an <l>on()</l> method can be used with this setting. |
| |
| <p> |
| The following example shows the equivalent methods for applying the <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation: |
| <p class='bjava'> |
| <jc>// Class with explicit annotation.</jc> |
| <ja>@Bean</ja>(properties=<js>"street,city,state"</js>) |
| <jk>public class</jk> A {...} |
| |
| <jc>// Class with annotation applied via @BeanConfig</jc> |
| <jk>public class</jk> B {...} |
| |
| <jc>// Java REST method with @BeanConfig annotation.</jc> |
| <ja>@RestGet</ja>(...) |
| <ja>@Bean</ja>(on=<js>"B"</js>, properties=<js>"street,city,state"</js>) |
| <jk>public void</jk> doFoo() {...} |
| </p> |
| |
| <p> |
| In general, the underlying framework uses this method when it finds dynamically applied annotations on |
| config annotations. However, concrete implementations of annotations are also provided that can be passed |
| directly into builder classes like so: |
| <p class='bjava'> |
| <jc>// Create a concrete @Bean annotation.</jc> |
| <ja>Bean</ja> <jv>annotation</jv> = BeanAnnotation.<jsm>create</jsm>(B.<jk>class</jk>).properties(<js>"street,city,state"</js>).build(); |
| |
| <jc>// Apply it to a serializer.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer.<jsm>create</jsm>().annotations(<jv>annotation</jv>).build(); |
| |
| <jc>// Serialize a bean with the dynamically applied annotation.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> B()); |
| </p> |
| |
| <p> |
| The following is the list of annotations builders provided that can be constructed |
| and passed into the builder class: |
| <ul class='javatreec'> |
| <li class='ja'><a href="../annotation/BeanAnnotation.html" title="class in org.apache.juneau.annotation"><code>BeanAnnotation</code></a> |
| <li class='ja'><a href="../annotation/BeancAnnotation.html" title="class in org.apache.juneau.annotation"><code>BeancAnnotation</code></a> |
| <li class='ja'><a href="../annotation/BeanIgnoreAnnotation.html" title="class in org.apache.juneau.annotation"><code>BeanIgnoreAnnotation</code></a> |
| <li class='ja'><a href="../annotation/BeanpAnnotation.html" title="class in org.apache.juneau.annotation"><code>BeanpAnnotation</code></a> |
| <li class='ja'><a href="../annotation/ExampleAnnotation.html" title="class in org.apache.juneau.annotation"><code>ExampleAnnotation</code></a> |
| <li class='ja'><a href="../annotation/NamePropertyAnnotation.html" title="class in org.apache.juneau.annotation"><code>NamePropertyAnnotation</code></a> |
| <li class='ja'><a href="../annotation/ParentPropertyAnnotation.html" title="class in org.apache.juneau.annotation"><code>ParentPropertyAnnotation</code></a> |
| <li class='ja'><a href="../annotation/SwapAnnotation.html" title="class in org.apache.juneau.annotation"><code>SwapAnnotation</code></a> |
| <li class='ja'><a href="../annotation/UriAnnotation.html" title="class in org.apache.juneau.annotation"><code>UriAnnotation</code></a> |
| <li class='ja'><a href="../csv/annotation/CsvAnnotation.html" title="class in org.apache.juneau.csv.annotation"><code>CsvAnnotation</code></a> |
| <li class='ja'><a href="../html/annotation/HtmlAnnotation.html" title="class in org.apache.juneau.html.annotation"><code>HtmlAnnotation</code></a> |
| <li class='ja'><a href="annotation/JsonAnnotation.html" title="class in org.apache.juneau.json.annotation"><code>JsonAnnotation</code></a> |
| <li class='ja'><a href="../annotation/SchemaAnnotation.html" title="class in org.apache.juneau.annotation"><code>SchemaAnnotation</code></a> |
| <li class='ja'><a href="../msgpack/annotation/MsgPackAnnotation.html" title="class in org.apache.juneau.msgpack.annotation"><code>MsgPackAnnotation</code></a> |
| <li class='ja'><a href="../oapi/annotation/OpenApiAnnotation.html" title="class in org.apache.juneau.oapi.annotation"><code>OpenApiAnnotation</code></a> |
| <li class='ja'><a href="../plaintext/annotation/PlainTextAnnotation.html" title="class in org.apache.juneau.plaintext.annotation"><code>PlainTextAnnotation</code></a> |
| <li class='ja'><a href="../soap/annotation/SoapXmlAnnotation.html" title="class in org.apache.juneau.soap.annotation"><code>SoapXmlAnnotation</code></a> |
| <li class='ja'><a href="../uon/annotation/UonAnnotation.html" title="class in org.apache.juneau.uon.annotation"><code>UonAnnotation</code></a> |
| <li class='ja'><a href="../urlencoding/annotation/UrlEncodingAnnotation.html" title="class in org.apache.juneau.urlencoding.annotation"><code>UrlEncodingAnnotation</code></a> |
| <li class='ja'><a href="../xml/annotation/XmlAnnotation.html" title="class in org.apache.juneau.xml.annotation"><code>XmlAnnotation</code></a> |
| </ul> |
| |
| <p> |
| The syntax for the <l>on()</l> pattern match parameter depends on whether it applies to a class, method, field, or constructor. |
| The valid pattern matches are: |
| <ul class='spaced-list'> |
| <li>Classes: |
| <ul> |
| <li>Fully qualified: |
| <ul> |
| <li><js>"com.foo.MyClass"</js> |
| </ul> |
| <li>Fully qualified inner class: |
| <ul> |
| <li><js>"com.foo.MyClass$Inner1$Inner2"</js> |
| </ul> |
| <li>Simple: |
| <ul> |
| <li><js>"MyClass"</js> |
| </ul> |
| <li>Simple inner: |
| <ul> |
| <li><js>"MyClass$Inner1$Inner2"</js> |
| <li><js>"Inner1$Inner2"</js> |
| <li><js>"Inner2"</js> |
| </ul> |
| </ul> |
| <li>Methods: |
| <ul> |
| <li>Fully qualified with args: |
| <ul> |
| <li><js>"com.foo.MyClass.myMethod(String,int)"</js> |
| <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> |
| <li><js>"com.foo.MyClass.myMethod()"</js> |
| </ul> |
| <li>Fully qualified: |
| <ul> |
| <li><js>"com.foo.MyClass.myMethod"</js> |
| </ul> |
| <li>Simple with args: |
| <ul> |
| <li><js>"MyClass.myMethod(String,int)"</js> |
| <li><js>"MyClass.myMethod(java.lang.String,int)"</js> |
| <li><js>"MyClass.myMethod()"</js> |
| </ul> |
| <li>Simple: |
| <ul> |
| <li><js>"MyClass.myMethod"</js> |
| </ul> |
| <li>Simple inner class: |
| <ul> |
| <li><js>"MyClass$Inner1$Inner2.myMethod"</js> |
| <li><js>"Inner1$Inner2.myMethod"</js> |
| <li><js>"Inner2.myMethod"</js> |
| </ul> |
| </ul> |
| <li>Fields: |
| <ul> |
| <li>Fully qualified: |
| <ul> |
| <li><js>"com.foo.MyClass.myField"</js> |
| </ul> |
| <li>Simple: |
| <ul> |
| <li><js>"MyClass.myField"</js> |
| </ul> |
| <li>Simple inner class: |
| <ul> |
| <li><js>"MyClass$Inner1$Inner2.myField"</js> |
| <li><js>"Inner1$Inner2.myField"</js> |
| <li><js>"Inner2.myField"</js> |
| </ul> |
| </ul> |
| <li>Constructors: |
| <ul> |
| <li>Fully qualified with args: |
| <ul> |
| <li><js>"com.foo.MyClass(String,int)"</js> |
| <li><js>"com.foo.MyClass(java.lang.String,int)"</js> |
| <li><js>"com.foo.MyClass()"</js> |
| </ul> |
| <li>Simple with args: |
| <ul> |
| <li><js>"MyClass(String,int)"</js> |
| <li><js>"MyClass(java.lang.String,int)"</js> |
| <li><js>"MyClass()"</js> |
| </ul> |
| <li>Simple inner class: |
| <ul> |
| <li><js>"MyClass$Inner1$Inner2()"</js> |
| <li><js>"Inner1$Inner2()"</js> |
| <li><js>"Inner2()"</js> |
| </ul> |
| </ul> |
| <li>A comma-delimited list of anything on this list. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html" title="annotation in org.apache.juneau.annotation"><code>BeanConfig</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#annotations(java.lang.annotation.Annotation...)">annotations</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The annotations to register with the context.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="apply(org.apache.juneau.AnnotationWorkList)">apply</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.328">apply</a></span>​(<span class="arguments"><a href="../AnnotationWorkList.html" title="class in org.apache.juneau">AnnotationWorkList</a> work)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#apply(org.apache.juneau.AnnotationWorkList)">Context.Builder</a></code></span></div> |
| <div class="block">Applies a set of applied to this builder. |
| |
| <p> |
| An <a href="../AnnotationWork.html" title="class in org.apache.juneau"><code>AnnotationWork</code></a> consists of a single pair of <a href="../reflect/AnnotationInfo.html" title="class in org.apache.juneau.reflect"><code>AnnotationInfo</code></a> that represents an annotation instance, |
| and <a href="../AnnotationApplier.html" title="class in org.apache.juneau"><code>AnnotationApplier</code></a> which represents the code used to apply the values in that annotation to a specific builder. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A class annotated with a config annotation.</jc> |
| <ja>@BeanConfig</ja>(sortProperties=<js>"$S{sortProperties,false}"</js>) |
| <jk>public class</jk> MyClass {...} |
| |
| <jc>// Find all annotations that themselves are annotated with @ContextPropertiesApply.</jc> |
| AnnotationList <jv>annotations</jv> = ClassInfo.<jsm>of</jsm>(MyClass.<jk>class</jk>).getAnnotationList(<jsf>CONTEXT_APPLY_FILTER</jsf>); |
| VarResolverSession <jv>vrs</jv> = VarResolver.<jsf>DEFAULT</jsf>.createSession(); |
| AnnotationWorkList <jv>work</jv> = AnnotationWorkList.of(<jv>vrs</jv>, <jv>annotations</jv>); |
| |
| <jc>// Apply any settings found on the annotations.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .apply(<jv>work</jv>) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#apply(org.apache.juneau.AnnotationWorkList)">apply</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>work</code> - The list of annotations and appliers to apply to this builder.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="applyAnnotations(java.lang.Class...)">applyAnnotations</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.334">applyAnnotations</a></span>​(<span class="arguments">java.lang.Class<?>... fromClasses)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#applyAnnotations(java.lang.Class...)">Context.Builder</a></code></span></div> |
| <div class="block">Applies any of the various <ja>@XConfig</ja> annotations on the specified class to this context. |
| |
| <p> |
| Any annotations found that themselves are annotated with <a href="../annotation/ContextApply.html" title="annotation in org.apache.juneau.annotation"><code>ContextApply</code></a> will be resolved and |
| applied as properties to this builder. These annotations include: |
| <ul class='javatreec'> |
| <li class='ja'><a href="../annotation/BeanConfig.html" title="annotation in org.apache.juneau.annotation"><code>BeanConfig</code></a> |
| <li class='ja'><a href="../csv/annotation/CsvConfig.html" title="annotation in org.apache.juneau.csv.annotation"><code>CsvConfig</code></a> |
| <li class='ja'><a href="../html/annotation/HtmlConfig.html" title="annotation in org.apache.juneau.html.annotation"><code>HtmlConfig</code></a> |
| <li class='ja'><a href="../html/annotation/HtmlDocConfig.html" title="annotation in org.apache.juneau.html.annotation"><code>HtmlDocConfig</code></a> |
| <li class='ja'><a href="annotation/JsonConfig.html" title="annotation in org.apache.juneau.json.annotation"><code>JsonConfig</code></a> |
| <li class='ja'><a href="../jsonschema/annotation/JsonSchemaConfig.html" title="annotation in org.apache.juneau.jsonschema.annotation"><code>JsonSchemaConfig</code></a> |
| <li class='ja'><a href="../msgpack/annotation/MsgPackConfig.html" title="annotation in org.apache.juneau.msgpack.annotation"><code>MsgPackConfig</code></a> |
| <li class='ja'><a href="../oapi/annotation/OpenApiConfig.html" title="annotation in org.apache.juneau.oapi.annotation"><code>OpenApiConfig</code></a> |
| <li class='ja'><a href="../parser/annotation/ParserConfig.html" title="annotation in org.apache.juneau.parser.annotation"><code>ParserConfig</code></a> |
| <li class='ja'><a href="../plaintext/annotation/PlainTextConfig.html" title="annotation in org.apache.juneau.plaintext.annotation"><code>PlainTextConfig</code></a> |
| <li class='ja'><a href="../serializer/annotation/SerializerConfig.html" title="annotation in org.apache.juneau.serializer.annotation"><code>SerializerConfig</code></a> |
| <li class='ja'><a href="../soap/annotation/SoapXmlConfig.html" title="annotation in org.apache.juneau.soap.annotation"><code>SoapXmlConfig</code></a> |
| <li class='ja'><a href="../uon/annotation/UonConfig.html" title="annotation in org.apache.juneau.uon.annotation"><code>UonConfig</code></a> |
| <li class='ja'><a href="../urlencoding/annotation/UrlEncodingConfig.html" title="annotation in org.apache.juneau.urlencoding.annotation"><code>UrlEncodingConfig</code></a> |
| <li class='ja'><a href="../xml/annotation/XmlConfig.html" title="annotation in org.apache.juneau.xml.annotation"><code>XmlConfig</code></a> |
| <li class='ja'><c>RdfConfig</c> |
| </ul> |
| |
| <p> |
| Annotations on classes are appended in the following order: |
| <ol> |
| <li>On the package of this class. |
| <li>On interfaces ordered parent-to-child. |
| <li>On parent classes ordered parent-to-child. |
| <li>On this class. |
| </ol> |
| |
| <p> |
| The default var resolver <a href="../svl/VarResolver.html#DEFAULT"><code>VarResolver.DEFAULT</code></a> is used to resolve any variables in annotation field values. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A class annotated with a config annotation.</jc> |
| <ja>@BeanConfig</ja>(sortProperties=<js>"$S{sortProperties,false}"</js>) |
| <jk>public class</jk> MyClass {...} |
| |
| <jc>// Apply any settings found on the annotations.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .applyAnnotations(MyClass.<jk>class</jk>) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#applyAnnotations(java.lang.Class...)">applyAnnotations</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>fromClasses</code> - The classes on which the annotations are defined.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="applyAnnotations(java.lang.reflect.Method...)">applyAnnotations</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.340">applyAnnotations</a></span>​(<span class="arguments">java.lang.reflect.Method... fromMethods)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#applyAnnotations(java.lang.reflect.Method...)">Context.Builder</a></code></span></div> |
| <div class="block">Applies any of the various <ja>@XConfig</ja> annotations on the specified method to this context. |
| |
| <p> |
| Any annotations found that themselves are annotated with <a href="../annotation/ContextApply.html" title="annotation in org.apache.juneau.annotation"><code>ContextApply</code></a> will be resolved and |
| applied as properties to this builder. These annotations include: |
| <ul class='javatreec'> |
| <li class='ja'><a href="../annotation/BeanConfig.html" title="annotation in org.apache.juneau.annotation"><code>BeanConfig</code></a> |
| <li class='ja'><a href="../csv/annotation/CsvConfig.html" title="annotation in org.apache.juneau.csv.annotation"><code>CsvConfig</code></a> |
| <li class='ja'><a href="../html/annotation/HtmlConfig.html" title="annotation in org.apache.juneau.html.annotation"><code>HtmlConfig</code></a> |
| <li class='ja'><a href="../html/annotation/HtmlDocConfig.html" title="annotation in org.apache.juneau.html.annotation"><code>HtmlDocConfig</code></a> |
| <li class='ja'><a href="annotation/JsonConfig.html" title="annotation in org.apache.juneau.json.annotation"><code>JsonConfig</code></a> |
| <li class='ja'><a href="../jsonschema/annotation/JsonSchemaConfig.html" title="annotation in org.apache.juneau.jsonschema.annotation"><code>JsonSchemaConfig</code></a> |
| <li class='ja'><a href="../msgpack/annotation/MsgPackConfig.html" title="annotation in org.apache.juneau.msgpack.annotation"><code>MsgPackConfig</code></a> |
| <li class='ja'><a href="../oapi/annotation/OpenApiConfig.html" title="annotation in org.apache.juneau.oapi.annotation"><code>OpenApiConfig</code></a> |
| <li class='ja'><a href="../parser/annotation/ParserConfig.html" title="annotation in org.apache.juneau.parser.annotation"><code>ParserConfig</code></a> |
| <li class='ja'><a href="../plaintext/annotation/PlainTextConfig.html" title="annotation in org.apache.juneau.plaintext.annotation"><code>PlainTextConfig</code></a> |
| <li class='ja'><a href="../serializer/annotation/SerializerConfig.html" title="annotation in org.apache.juneau.serializer.annotation"><code>SerializerConfig</code></a> |
| <li class='ja'><a href="../soap/annotation/SoapXmlConfig.html" title="annotation in org.apache.juneau.soap.annotation"><code>SoapXmlConfig</code></a> |
| <li class='ja'><a href="../uon/annotation/UonConfig.html" title="annotation in org.apache.juneau.uon.annotation"><code>UonConfig</code></a> |
| <li class='ja'><a href="../urlencoding/annotation/UrlEncodingConfig.html" title="annotation in org.apache.juneau.urlencoding.annotation"><code>UrlEncodingConfig</code></a> |
| <li class='ja'><a href="../xml/annotation/XmlConfig.html" title="annotation in org.apache.juneau.xml.annotation"><code>XmlConfig</code></a> |
| <li class='ja'><c>RdfConfig</c> |
| </ul> |
| |
| <p> |
| Annotations on methods are appended in the following order: |
| <ol> |
| <li>On the package of the method class. |
| <li>On interfaces ordered parent-to-child. |
| <li>On parent classes ordered parent-to-child. |
| <li>On the method class. |
| <li>On this method and matching methods ordered parent-to-child. |
| </ol> |
| |
| <p> |
| The default var resolver <a href="../svl/VarResolver.html#DEFAULT"><code>VarResolver.DEFAULT</code></a> is used to resolve any variables in annotation field values. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A method annotated with a config annotation.</jc> |
| <jk>public class</jk> MyClass { |
| <ja>@BeanConfig</ja>(sortProperties=<js>"$S{sortProperties,false}"</js>) |
| <jk>public void</jk> myMethod() {...} |
| } |
| |
| <jc>// Apply any settings found on the annotations.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .applyAnnotations(MyClass.<jk>class</jk>.getMethod(<js>"myMethod"</js>)) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#applyAnnotations(java.lang.reflect.Method...)">applyAnnotations</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>fromMethods</code> - The methods on which the annotations are defined.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="cache(org.apache.juneau.internal.Cache)">cache</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.346">cache</a></span>​(<span class="arguments"><a href="../internal/Cache.html" title="class in org.apache.juneau.internal">Cache</a><<a href="../utils/HashKey.html" title="class in org.apache.juneau.utils">HashKey</a>,​? extends <a href="../Context.html" title="class in org.apache.juneau">Context</a>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#cache(org.apache.juneau.internal.Cache)">Context.Builder</a></code></span></div> |
| <div class="block">Specifies a cache to use for hashkey-based caching.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#cache(org.apache.juneau.internal.Cache)">cache</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The cache.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="debug()">debug</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.352">debug</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#debug()">Context.Builder</a></code></span></div> |
| <div class="block"><i><l>Context</l> configuration property: </i> Debug mode. |
| |
| <p> |
| Enables the following additional information during serialization: |
| <ul class='spaced-list'> |
| <li> |
| When bean getters throws exceptions, the exception includes the object stack information |
| in order to determine how that method was invoked. |
| <li> |
| Enables <a href="../BeanTraverseContext.Builder.html#detectRecursions()"><code>BeanTraverseContext.Builder.detectRecursions()</code></a>. |
| </ul> |
| |
| <p> |
| Enables the following additional information during parsing: |
| <ul class='spaced-list'> |
| <li> |
| When bean setters throws exceptions, the exception includes the object stack information |
| in order to determine how that method was invoked. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer with debug enabled.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .debug() |
| .build(); |
| |
| <jc>// Create a POJO model with a recursive loop.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>f</jf>; |
| } |
| MyBean <jv>bean</jv> = <jk>new</jk> MyBean(); |
| <jv>bean</jv>.<jf>f</jf> = <jv>bean</jv>; |
| |
| <jc>// Throws a SerializeException and not a StackOverflowError</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>bean</jv>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#debug()"><code>BeanConfig.debug()</code></a> |
| <li class='jm'><a href="../ContextSession.Builder.html#debug(java.lang.Boolean)"><code>ContextSession.Builder.debug(Boolean)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#debug()">debug</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="debug(boolean)">debug</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.358">debug</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#debug(boolean)">Context.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../Context.Builder.html#debug()"><code>Context.Builder.debug()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#debug(boolean)">debug</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="impl(org.apache.juneau.Context)">impl</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.364">impl</a></span>​(<span class="arguments"><a href="../Context.html" title="class in org.apache.juneau">Context</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#impl(org.apache.juneau.Context)">Context.Builder</a></code></span></div> |
| <div class="block">Specifies a pre-instantiated bean for the <a href="../Context.Builder.html#build()"><code>Context.Builder.build()</code></a> method to return.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#impl(org.apache.juneau.Context)">impl</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="type(java.lang.Class)">type</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.370">type</a></span>​(<span class="arguments">java.lang.Class<? extends <a href="../Context.html" title="class in org.apache.juneau">Context</a>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../Context.Builder.html#type(java.lang.Class)">Context.Builder</a></code></span></div> |
| <div class="block">Associates a context class with this builder. |
| |
| <p> |
| This is the type of object that this builder creates when the <a href="../Context.Builder.html#build()"><code>Context.Builder.build()</code></a> method is called. |
| |
| <p> |
| By default, it's the outer class of where the builder class is defined.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#type(java.lang.Class)">type</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The context class that this builder should create.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanClassVisibility(org.apache.juneau.Visibility)">beanClassVisibility</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.376">beanClassVisibility</a></span>​(<span class="arguments"><a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanClassVisibility(org.apache.juneau.Visibility)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Minimum bean class visibility. |
| |
| <p> |
| Classes are not considered beans unless they meet the minimum visibility requirements. |
| For example, if the visibility is <jsf>PUBLIC</jsf> and the bean class is <jk>protected</jk>, then the class |
| will not be interpreted as a bean class and be serialized as a string. |
| Use this setting to reduce the visibility requirement. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a protected class and one field.</jc> |
| <jk>protected class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Create a serializer that's capable of serializing the class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanClassVisibility(<jsf>PROTECTED</jsf>) |
| .build(); |
| |
| <jc>// Produces: {"foo","bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation can be used on a non-public bean class to override this setting. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a public bean class to ignore it as a bean. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beanClassVisibility()"><code>BeanConfig.beanClassVisibility()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanClassVisibility(org.apache.juneau.Visibility)">beanClassVisibility</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../Visibility.html#PUBLIC"><code>Visibility.PUBLIC</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanConstructorVisibility(org.apache.juneau.Visibility)">beanConstructorVisibility</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.382">beanConstructorVisibility</a></span>​(<span class="arguments"><a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanConstructorVisibility(org.apache.juneau.Visibility)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Minimum bean constructor visibility. |
| |
| <p> |
| Only look for constructors with the specified minimum visibility. |
| |
| <p> |
| This setting affects the logic for finding no-arg constructors for bean. Normally, only <jk>public</jk> no-arg |
| constructors are used. Use this setting if you want to reduce the visibility requirement. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a protected constructor and one field.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>; |
| |
| <jk>protected</jk> MyBean() {} |
| } |
| |
| <jc>// Create a parser capable of calling the protected constructor.</jc> |
| ReaderParser <jv>parser</jv> = ReaderParser |
| .<jsm>create</jsm>() |
| .beanConstructorVisibility(<jsf>PROTECTED</jsf>) |
| .build(); |
| |
| <jc>// Use it.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanc.html" title="annotation in org.apache.juneau.annotation"><code>@Beanc</code></a> annotation can also be used to expose a non-public constructor. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a public bean constructor to ignore it. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beanConstructorVisibility()"><code>BeanConfig.beanConstructorVisibility()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanConstructorVisibility(org.apache.juneau.Visibility)">beanConstructorVisibility</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../Visibility.html#PUBLIC"><code>Visibility.PUBLIC</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanContext(org.apache.juneau.BeanContext)">beanContext</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.388">beanContext</a></span>​(<span class="arguments"><a href="../BeanContext.html" title="class in org.apache.juneau">BeanContext</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanContext(org.apache.juneau.BeanContext)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Specifies an already-instantiated bean context to use. |
| |
| <p> |
| Provides an optimization for cases where serializers and parsers can use an existing |
| bean context without having to go through <c><jv>beanContext</jv>.copy().build()</c>. |
| An example is <a href="../BeanContext.html#getBeanToStringSerializer()"><code>BeanContext.getBeanToStringSerializer()</code></a>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanContext(org.apache.juneau.BeanContext)">beanContext</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The bean context to use.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanContext(org.apache.juneau.BeanContext.Builder)">beanContext</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.394">beanContext</a></span>​(<span class="arguments"><a href="../BeanContext.Builder.html" title="class in org.apache.juneau">BeanContext.Builder</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanContext(org.apache.juneau.BeanContext.Builder)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Overrides the bean context builder. |
| |
| <p> |
| Used when sharing bean context builders across multiple context objects. |
| For example, <a href="../jsonschema/JsonSchemaGenerator.Builder.html" title="class in org.apache.juneau.jsonschema"><code>JsonSchemaGenerator.Builder</code></a> uses this to apply common bean settings with the JSON |
| serializer and parser.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanContext(org.apache.juneau.BeanContext.Builder)">beanContext</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanDictionary(java.lang.Class...)">beanDictionary</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.400">beanDictionary</a></span>​(<span class="arguments">java.lang.Class<?>... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanDictionary(java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean dictionary. |
| |
| <p> |
| The list of classes that make up the bean dictionary in this bean context. |
| |
| <p> |
| Values are prepended to the list so that later calls can override classes of earlier calls. |
| |
| <p> |
| A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred |
| through reflection. The names are defined through the <a href="../annotation/Bean.html#typeName()"><code>@Bean(typeName)</code></a> annotation defined |
| on the bean class. For example, if a class <c>Foo</c> has a type-name of <js>"myfoo"</js>, then it would end up |
| serialized as <js>"{_type:'myfoo',...}"</js> in JSON |
| or <js>"<myfoo>...</myfoo>"</js> in XML. |
| |
| <p> |
| This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes. |
| |
| <p> |
| Values can consist of any of the following types: |
| <ul> |
| <li>Any bean class that specifies a value for <a href="../annotation/Bean.html#typeName()"><code>@Bean(typeName)</code></a>. |
| <li>Any subclass of <a href="../BeanDictionaryList.html" title="class in org.apache.juneau"><code>BeanDictionaryList</code></a> containing a collection of bean classes with type name annotations. |
| <li>Any subclass of <a href="../BeanDictionaryMap.html" title="class in org.apache.juneau"><code>BeanDictionaryMap</code></a> containing a mapping of type names to classes without type name annotations. |
| <li>Any array or collection of the objects above. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// POJOs with @Bean(name) annotations.</jc> |
| <ja>@Bean</ja>(typeName=<js>"foo"</js>) |
| <jk>public class</jk> Foo {...} |
| <ja>@Bean</ja>(typeName=<js>"bar"</js>) |
| <jk>public class</jk> Bar {...} |
| |
| <jc>// Create a parser and tell it which classes to try to resolve.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>) |
| .addBeanTypes() |
| .build(); |
| |
| <jc>// A bean with a field with an indeterminate type.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>mySimpleField</jf>; |
| } |
| |
| <jc>// Parse bean.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{mySimpleField:{_type:'foo',...}}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| Another option is to use the <a href="../annotation/Bean.html#dictionary()"><code>Bean.dictionary()</code></a> annotation on the POJO class itself: |
| |
| <p class='bjava'> |
| <jc>// Instead of by parser, define a bean dictionary on a class through an annotation.</jc> |
| <jc>// This applies to all properties on this class and all subclasses.</jc> |
| <ja>@Bean</ja>(dictionary={Foo.<jk>class</jk>,Bar.<jk>class</jk>}) |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>mySimpleField</jf>; <jc>// May contain Foo or Bar object.</jc> |
| <jk>public</jk> Map<String,Object> <jf>myMapField</jf>; <jc>// May contain Foo or Bar objects.</jc> |
| } |
| </p> |
| |
| <p> |
| A typical usage is to allow for HTML documents to be parsed back into HTML beans: |
| <p class='bjava'> |
| <jc>// Use the predefined HTML5 bean dictionary which is a BeanDictionaryList.</jc> |
| ReaderParser <jv>parser</jv> = HtmlParser |
| .<jsm>create</jsm>() |
| .dictionary(HtmlBeanDictionary.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Parse an HTML body into HTML beans.</jc> |
| Body <jv>body</jv> = <jv>parser</jv>.parse(<js>"<body><ul><li>foo</li><li>bar</li></ul>"</js>, Body.<jk>class</jk>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#dictionary()"><code>Bean.dictionary()</code></a> |
| <li class='ja'><a href="../annotation/Beanp.html#dictionary()"><code>Beanp.dictionary()</code></a> |
| <li class='ja'><a href="../annotation/BeanConfig.html#dictionary()"><code>BeanConfig.dictionary()</code></a> |
| <li class='ja'><a href="../annotation/BeanConfig.html#dictionary_replace()"><code>BeanConfig.dictionary_replace()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanDictionary(java.lang.Class...)">beanDictionary</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanFieldVisibility(org.apache.juneau.Visibility)">beanFieldVisibility</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.406">beanFieldVisibility</a></span>​(<span class="arguments"><a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanFieldVisibility(org.apache.juneau.Visibility)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Minimum bean field visibility. |
| |
| <p> |
| Only look for bean fields with the specified minimum visibility. |
| |
| <p> |
| This affects which fields on a bean class are considered bean properties. Normally only <jk>public</jk> fields are considered. |
| Use this setting if you want to reduce the visibility requirement. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a protected field.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>protected</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Create a serializer that recognizes the protected field.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanFieldVisibility(<jsf>PROTECTED</jsf>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| Bean fields can be ignored as properties entirely by setting the value to <a href="../Visibility.html#NONE"><code>Visibility.NONE</code></a> |
| |
| <p class='bjava'> |
| <jc>// Disable using fields as properties entirely.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanFieldVisibility(<jsf>NONE</jsf>) |
| .build(); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanp.html" title="annotation in org.apache.juneau.annotation"><code>@Beanp</code></a> annotation can also be used to expose a non-public field. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a public bean field to ignore it as a bean property. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beanFieldVisibility()"><code>BeanConfig.beanFieldVisibility()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanFieldVisibility(org.apache.juneau.Visibility)">beanFieldVisibility</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../Visibility.html#PUBLIC"><code>Visibility.PUBLIC</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanInterceptor(java.lang.Class,java.lang.Class)">beanInterceptor</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.412">beanInterceptor</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.Class<? extends <a href="../swap/BeanInterceptor.html" title="class in org.apache.juneau.swap">BeanInterceptor</a><?>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanInterceptor(java.lang.Class,java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean interceptor. |
| |
| <p> |
| Bean interceptors can be used to intercept calls to getters and setters and alter their values in transit. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Interceptor that strips out sensitive information.</jc> |
| <jk>public class</jk> AddressInterceptor <jk>extends</jk> BeanInterceptor<Address> { |
| |
| <jk>public</jk> Object readProperty(Address <jv>bean</jv>, String <jv>name</jv>, Object <jv>value</jv>) { |
| <jk>if</jk> (<js>"taxInfo"</js>.equals(<jv>name</jv>)) |
| <jk>return</jk> <js>"redacted"</js>; |
| <jk>return</jk> <jv>value</jv>; |
| } |
| |
| <jk>public</jk> Object writeProperty(Address <jv>bean</jv>, String <jv>name</jv>, Object <jv>value</jv>) { |
| <jk>if</jk> (<js>"taxInfo"</js>.equals(<jv>name</jv>) && <js>"redacted"</js>.equals(<jv>value</jv>)) |
| <jk>return</jk> TaxInfoUtils.<jsm>lookup</jsm>(<jv>bean</jv>.getStreet(), <jv>bean</jv>.getCity(), <jv>bean</jv>.getState()); |
| <jk>return</jk> <jv>value</jv>; |
| } |
| } |
| |
| <jc>// Our bean class.</jc> |
| <jk>public class</jk> Address { |
| <jk>public</jk> String getTaxInfo() {...} |
| <jk>public void</jk> setTaxInfo(String <jv>value</jv>) {...} |
| } |
| |
| <jc>// Register filter on serializer or parser.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanInterceptor(Address.<jk>class</jk>, AddressInterceptor.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"taxInfo":"redacted"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> Address()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jc'><a href="../swap/BeanInterceptor.html" title="class in org.apache.juneau.swap"><code>BeanInterceptor</code></a> |
| <li class='ja'><a href="../annotation/Bean.html#interceptor()"><code>Bean(interceptor)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanInterceptor(java.lang.Class,java.lang.Class)">beanInterceptor</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The bean that the filter applies to.</dd> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanMapPutReturnsOldValue()">beanMapPutReturnsOldValue</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.418">beanMapPutReturnsOldValue</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanMapPutReturnsOldValue()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">BeanMap.put() returns old property value. |
| |
| <p> |
| When enabled, then the <a href="../BeanMap.html#put(java.lang.String,java.lang.Object)"><code>BeanMap.put()</code></a> method will return old property |
| values. Otherwise, it returns <jk>null</jk>. |
| |
| <p> |
| Disabled by default because it introduces a slight performance penalty during serialization. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a context that creates BeanMaps with normal put() behavior.</jc> |
| BeanContext <jv>context</jv> = BeanContext |
| .<jsm>create</jsm>() |
| .beanMapPutReturnsOldValue() |
| .build(); |
| |
| BeanMap<MyBean> <jv>beanMap</jv> = <jv>context</jv>.createSession().toBeanMap(<jk>new</jk> MyBean()); |
| <jv>beanMap</jv>.put(<js>"foo"</js>, <js>"bar"</js>); |
| Object <jv>oldValue</jv> = <jv>beanMap</jv>.put(<js>"foo"</js>, <js>"baz"</js>); <jc>// oldValue == "bar"</jc> |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beanMapPutReturnsOldValue()"><code>BeanConfig.beanMapPutReturnsOldValue()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beanMapPutReturnsOldValue()"><code>BeanContext.Builder.beanMapPutReturnsOldValue()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanMapPutReturnsOldValue()">beanMapPutReturnsOldValue</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanMethodVisibility(org.apache.juneau.Visibility)">beanMethodVisibility</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.424">beanMethodVisibility</a></span>​(<span class="arguments"><a href="../Visibility.html" title="enum in org.apache.juneau">Visibility</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanMethodVisibility(org.apache.juneau.Visibility)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Minimum bean method visibility. |
| |
| <p> |
| Only look for bean methods with the specified minimum visibility. |
| |
| <p> |
| This affects which methods are detected as getters and setters on a bean class. Normally only <jk>public</jk> getters and setters are considered. |
| Use this setting if you want to reduce the visibility requirement. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a protected getter.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String getFoo() { <jk>return</jk> <js>"foo"</js>; } |
| <jk>protected</jk> String getBar() { <jk>return</jk> <js>"bar"</js>; } |
| } |
| |
| <jc>// Create a serializer that looks for protected getters and setters.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanMethodVisibility(<jsf>PROTECTED</jsf>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo","bar":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanp.html" title="annotation in org.apache.juneau.annotation"><code>@Beanp</code></a> annotation can also be used to expose a non-public method. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a public bean getter/setter to ignore it as a bean property. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beanMethodVisibility()"><code>BeanConfig.beanMethodVisibility()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanMethodVisibility(org.apache.juneau.Visibility)">beanMethodVisibility</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../Visibility.html#PUBLIC"><code>Visibility.PUBLIC</code></a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanProperties(java.util.Map)">beanProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.430">beanProperties</a></span>​(<span class="arguments">java.util.Map<java.lang.String,​java.lang.Object> values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanProperties(java.util.Map)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property includes. |
| |
| <p> |
| Specifies the set and order of names of properties associated with bean classes. |
| |
| <p> |
| For example, <c>beanProperties(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"foo,bar"</js>))</c> means only serialize the <c>foo</c> and |
| <c>bar</c> properties on the specified bean. Likewise, parsing will ignore any bean properties not specified |
| and either throw an exception or silently ignore them depending on whether <a href="../BeanContextable.Builder.html#ignoreUnknownBeanProperties()"><code>BeanContextable.Builder.ignoreUnknownBeanProperties()</code></a> |
| has been called. |
| |
| <p> |
| This value is entirely optional if you simply want to expose all the getters and public fields on |
| a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be |
| serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, |
| whereas on Oracle JREs, the order is entirely random. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanProperties(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"foo,bar"</js>)) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo","bar":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code for each entry: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>key</jv>).properties(<jv>value</jv>.toString()).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#properties()"><code>Bean.properties()</code></a> / <a href="../annotation/Bean.html#p()"><code>Bean.p()</code></a>- On an annotation on the bean class itself. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanProperties(java.util.Map)">beanProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this builder. |
| <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans. |
| <br>Values are comma-delimited lists of property names. Non-String objects are first converted to Strings.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanProperties(java.lang.Class,java.lang.String)">beanProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.436">beanProperties</a></span>​(<span class="arguments">java.lang.Class<?> beanClass, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property includes. |
| |
| <p> |
| Specifies the set and order of names of properties associated with the bean class. |
| |
| <p> |
| For example, <c>beanProperties(MyBean.<jk>class</jk>, <js>"foo,bar"</js>)</c> means only serialize the <c>foo</c> and |
| <c>bar</c> properties on the specified bean. Likewise, parsing will ignore any bean properties not specified |
| and either throw an exception or silently ignore them depending on whether <a href="../BeanContextable.Builder.html#ignoreUnknownBeanProperties()"><code>BeanContextable.Builder.ignoreUnknownBeanProperties()</code></a> |
| has been called. |
| |
| <p> |
| This value is entirely optional if you simply want to expose all the getters and public fields on |
| a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be |
| serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, |
| whereas on Oracle JREs, the order is entirely random. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanProperties(MyBean.<jk>class</jk>, <js>"foo,bar"</js>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo","bar":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClass</jv>).properties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../annotation/Bean.html#properties()"><code>Bean.properties()</code></a>/<a href="../annotation/Bean.html#p()"><code>Bean.p()</code></a> - On an annotation on the bean class itself. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanProperties(java.lang.Class,java.lang.String)">beanProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClass</code> - The bean class.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanProperties(java.lang.String,java.lang.String)">beanProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.442">beanProperties</a></span>​(<span class="arguments">java.lang.String beanClassName, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanProperties(java.lang.String,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property includes. |
| |
| <p> |
| Specifies the set and order of names of properties associated with the bean class. |
| |
| <p> |
| For example, <c>beanProperties(<js>"MyBean"</js>, <js>"foo,bar"</js>)</c> means only serialize the <c>foo</c> and |
| <c>bar</c> properties on the specified bean. Likewise, parsing will ignore any bean properties not specified |
| and either throw an exception or silently ignore them depending on whether <a href="../BeanContextable.Builder.html#ignoreUnknownBeanProperties()"><code>BeanContextable.Builder.ignoreUnknownBeanProperties()</code></a> |
| has been called. |
| |
| <p> |
| This value is entirely optional if you simply want to expose all the getters and public fields on |
| a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be |
| serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, |
| whereas on Oracle JREs, the order is entirely random. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanProperties(<js>"MyBean"</js>, <js>"foo,bar"</js>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo","bar":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClassName</jv>).properties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#properties()"><code>Bean.properties()</code></a> / <a href="../annotation/Bean.html#p()"><code>Bean.p()</code></a> - On an annotation on the bean class itself. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanProperties(java.lang.String,java.lang.String)">beanProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClassName</code> - The bean class name. |
| <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesExcludes(java.util.Map)">beanPropertiesExcludes</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.448">beanPropertiesExcludes</a></span>​(<span class="arguments">java.util.Map<java.lang.String,​java.lang.Object> values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.util.Map)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property excludes. |
| |
| <p> |
| Specifies to exclude the specified list of properties for the specified bean classes. |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#beanProperties(java.util.Map)"><code>BeanContextable.Builder.beanProperties(Map)</code></a> except you specify a list of bean property names that you want to exclude from |
| serialization. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesExcludes(AMap.of(<js>"MyBean"</js>, <js>"bar,baz"</js>)) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code for each entry: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>key</jv>).excludeProperties(<jv>value</jv>.toString()).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#excludeProperties()"><code>Bean.excludeProperties()</code></a> / <a href="../annotation/Bean.html#xp()"><code>Bean.xp()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesExcludes(java.util.Map)">beanPropertiesExcludes</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this builder. |
| <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans. |
| <br>Values are comma-delimited lists of property names. Non-String objects are first converted to Strings.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesExcludes(java.lang.Class,java.lang.String)">beanPropertiesExcludes</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.454">beanPropertiesExcludes</a></span>​(<span class="arguments">java.lang.Class<?> beanClass, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property excludes. |
| |
| <p> |
| Specifies to exclude the specified list of properties for the specified bean class. |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>BeanContextable.Builder.beanProperties(Class, String)</code></a> except you specify a list of bean property names that you want to exclude from |
| serialization. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesExcludes(MyBean.<jk>class</jk>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClass</jv>).excludeProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#excludeProperties()"><code>Bean.excludeProperties()</code></a> / <a href="../annotation/Bean.html#xp()"><code>Bean.xp()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)">beanPropertiesExcludes</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClass</code> - The bean class.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesExcludes(java.lang.String,java.lang.String)">beanPropertiesExcludes</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.460">beanPropertiesExcludes</a></span>​(<span class="arguments">java.lang.String beanClassName, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.String,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property excludes. |
| |
| <p> |
| Specifies to exclude the specified list of properties for the specified bean class. |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.String,java.lang.String)"><code>BeanContextable.Builder.beanPropertiesExcludes(String, String)</code></a> except you specify a list of bean property names that you want to exclude from |
| serialization. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String |
| <jf>foo</jf> = <js>"foo"</js>, |
| <jf>bar</jf> = <js>"bar"</js>, |
| <jf>baz</jf> = <js>"baz"</js>; |
| } |
| |
| <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesExcludes(<js>"MyBean"</js>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClassName</jv>).excludeProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#excludeProperties()"><code>Bean.excludeProperties()</code></a> / <a href="../annotation/Bean.html#xp()"><code>Bean.xp()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesExcludes(java.lang.String,java.lang.String)">beanPropertiesExcludes</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClassName</code> - The bean class name. |
| <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesReadOnly(java.util.Map)">beanPropertiesReadOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.466">beanPropertiesReadOnly</a></span>​(<span class="arguments">java.util.Map<java.lang.String,​java.lang.Object> values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesReadOnly(java.util.Map)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Read-only bean properties. |
| |
| <p> |
| Specifies one or more properties on beans that are read-only despite having valid getters. |
| Serializers will serialize such properties as usual, but parsers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with read-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>)) |
| .build(); |
| |
| <jc>// All 3 properties will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with read-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>)) |
| .ignoreUnknownBeanProperties() |
| .build(); |
| |
| <jc>// Parser ignores bar and baz properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code for each entry: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>key</jv>).readOnlyProperties(<jv>value</jv>.toString()).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#readOnlyProperties()"><code>Bean.readOnlyProperties()</code></a> / <a href="../annotation/Bean.html#ro()"><code>Bean.ro()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesReadOnly(java.util.Map)">beanPropertiesReadOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this builder. |
| <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans. |
| <br>Values are comma-delimited lists of property names. Non-String objects are first converted to Strings.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesReadOnly(java.lang.Class,java.lang.String)">beanPropertiesReadOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.472">beanPropertiesReadOnly</a></span>​(<span class="arguments">java.lang.Class<?> beanClass, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesReadOnly(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Read-only bean properties. |
| |
| <p> |
| Specifies one or more properties on a bean that are read-only despite having valid getters. |
| Serializers will serialize such properties as usual, but parsers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with read-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(MyBean.<jk>class</jk>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// All 3 properties will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with read-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(MyBean.<jk>class</jk>, <js>"bar,baz"</js>) |
| .ignoreUnknownBeanProperties() |
| .build(); |
| |
| <jc>// Parser ignores bar and baz properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClass</jv>).readOnlyProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#readOnlyProperties()"><code>Bean.readOnlyProperties()</code></a> / <a href="../annotation/Bean.html#ro()"><code>Bean.ro()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesReadOnly(java.lang.Class,java.lang.String)">beanPropertiesReadOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClass</code> - The bean class.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesReadOnly(java.lang.String,java.lang.String)">beanPropertiesReadOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.478">beanPropertiesReadOnly</a></span>​(<span class="arguments">java.lang.String beanClassName, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesReadOnly(java.lang.String,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Read-only bean properties. |
| |
| <p> |
| Specifies one or more properties on a bean that are read-only despite having valid getters. |
| Serializers will serialize such properties as usual, but parsers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with read-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(<js>"MyBean"</js>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// All 3 properties will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with read-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesReadOnly(<js>"MyBean"</js>, <js>"bar,baz"</js>) |
| .ignoreUnknownBeanProperties() |
| .build(); |
| |
| <jc>// Parser ignores bar and baz properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClassName</jv>).readOnlyProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#readOnlyProperties()"><code>Bean.readOnlyProperties()</code></a> / <a href="../annotation/Bean.html#ro()"><code>Bean.ro()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesReadOnly(java.lang.String,java.lang.String)">beanPropertiesReadOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClassName</code> - The bean class name. |
| <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesWriteOnly(java.util.Map)">beanPropertiesWriteOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.484">beanPropertiesWriteOnly</a></span>​(<span class="arguments">java.util.Map<java.lang.String,​java.lang.Object> values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesWriteOnly(java.util.Map)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Write-only bean properties. |
| |
| <p> |
| Specifies one or more properties on a bean that are write-only despite having valid setters. |
| Parsers will parse such properties as usual, but serializers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with write-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>)) |
| .build(); |
| |
| <jc>// Only foo will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with write-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>)) |
| .build(); |
| |
| <jc>// Parser parses all 3 properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code for each entry: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>key</jv>).writeOnlyProperties(<jv>value</jv>.toString()).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#writeOnlyProperties()"><code>Bean.writeOnlyProperties()</code></a> / <a href="../annotation/Bean.html#wo()"><code>Bean.wo()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesWriteOnly(java.util.Map)">beanPropertiesWriteOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this builder. |
| <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans. |
| <br>Values are comma-delimited lists of property names. Non-String objects are first converted to Strings.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesWriteOnly(java.lang.Class,java.lang.String)">beanPropertiesWriteOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.490">beanPropertiesWriteOnly</a></span>​(<span class="arguments">java.lang.Class<?> beanClass, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesWriteOnly(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Write-only bean properties. |
| |
| <p> |
| Specifies one or more properties on a bean that are write-only despite having valid setters. |
| Parsers will parse such properties as usual, but serializers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with write-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(MyBean.<jk>class</jk>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Only foo will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with write-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(MyBean.<jk>class</jk>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Parser parses all 3 properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClass</jv>).writeOnlyProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#writeOnlyProperties()"><code>Bean.writeOnlyProperties()</code></a> / <a href="../annotation/Bean.html#wo()"><code>Bean.wo()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesWriteOnly(java.lang.Class,java.lang.String)">beanPropertiesWriteOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClass</code> - The bean class.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beanPropertiesWriteOnly(java.lang.String,java.lang.String)">beanPropertiesWriteOnly</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.496">beanPropertiesWriteOnly</a></span>​(<span class="arguments">java.lang.String beanClassName, |
| java.lang.String properties)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beanPropertiesWriteOnly(java.lang.String,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Write-only bean properties. |
| |
| <p> |
| Specifies one or more properties on a bean that are write-only despite having valid setters. |
| Parsers will parse such properties as usual, but serializers will silently ignore them. |
| Note that this is different from the <a href="../BeanContextable.Builder.html#beanProperties(java.lang.Class,java.lang.String)"><code>beanProperties</code></a>/<a href="../BeanContextable.Builder.html#beanPropertiesExcludes(java.lang.Class,java.lang.String)"><code>beanPropertiesExcludes</code></a> settings which include or exclude properties |
| for both serializers and parsers. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>; |
| } |
| |
| <jc>// Create a serializer with write-only property settings.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(<js>"MyBean"</js>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Only foo will be serialized.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a parser with write-only property settings.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .beanPropertiesWriteOnly(<js>"MyBean"</js>, <js>"bar,baz"</js>) |
| .build(); |
| |
| <jc>// Parser parses all 3 properties.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This method is functionally equivalent to the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(BeanAnnotation.<jsm>create</jsm>(<jv>beanClassName</jv>).writeOnlyProperties(<jv>properties</jv>).build()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jma'><a href="../annotation/Bean.html#writeOnlyProperties()"><code>Bean.writeOnlyProperties()</code></a> / <a href="../annotation/Bean.html#wo()"><code>Bean.wo()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beanPropertiesWriteOnly(java.lang.String,java.lang.String)">beanPropertiesWriteOnly</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>beanClassName</code> - The bean class name. |
| <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.</dd> |
| <dd><code>properties</code> - Comma-delimited list of property names.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beansRequireDefaultConstructor()">beansRequireDefaultConstructor</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.502">beansRequireDefaultConstructor</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beansRequireDefaultConstructor()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Beans require no-arg constructors. |
| |
| <p> |
| When enabled, a Java class must implement a default no-arg constructor to be considered a bean. |
| Otherwise, the bean will be serialized as a string using the <code>Object.toString()</code> method. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean without a no-arg constructor.</jc> |
| <jk>public class</jk> MyBean { |
| |
| <jc>// A property method.</jc> |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| |
| <jc>// A no-arg constructor</jc> |
| <jk>public</jk> MyBean(String <jv>foo</jv>) { |
| <jk>this</jk>.<jf>foo</jf> = <jv>foo</jv>; |
| } |
| |
| <ja>@Override</ja> |
| <jk>public</jk> String toString() { |
| <jk>return</jk> <js>"bar"</js>; |
| } |
| } |
| |
| <jc>// Create a serializer that ignores beans without default constructors.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beansRequireDefaultConstructor() |
| .build(); |
| |
| <jc>// Produces: "bar"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation can be used on a bean class to override this setting. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a class to ignore it as a bean. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beansRequireDefaultConstructor()"><code>BeanConfig.beansRequireDefaultConstructor()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beansRequireDefaultConstructor()"><code>BeanContext.Builder.beansRequireDefaultConstructor()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beansRequireDefaultConstructor()">beansRequireDefaultConstructor</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beansRequireSerializable()">beansRequireSerializable</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.508">beansRequireSerializable</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beansRequireSerializable()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Beans require Serializable interface. |
| |
| <p> |
| When enabled, a Java class must implement the <code>Serializable</code> interface to be considered a bean. |
| Otherwise, the bean will be serialized as a string using the <code>Object.toString()</code> method. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean without a Serializable interface.</jc> |
| <jk>public class</jk> MyBean { |
| |
| <jc>// A property method.</jc> |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| |
| <ja>@Override</ja> |
| <jk>public</jk> String toString() { |
| <jk>return</jk> <js>"bar"</js>; |
| } |
| } |
| |
| <jc>// Create a serializer that ignores beans not implementing Serializable.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beansRequireSerializable() |
| .build(); |
| |
| <jc>// Produces: "bar"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation can be used on a bean class to override this setting. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on a class to ignore it as a bean. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beansRequireSerializable()"><code>BeanConfig.beansRequireSerializable()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beansRequireSerializable()"><code>BeanContext.Builder.beansRequireSerializable()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beansRequireSerializable()">beansRequireSerializable</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="beansRequireSettersForGetters()">beansRequireSettersForGetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.514">beansRequireSettersForGetters</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#beansRequireSettersForGetters()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Beans require setters for getters. |
| |
| <p> |
| When enabled, ignore read-only properties (properties with getters but not setters). |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean without a Serializable interface.</jc> |
| <jk>public class</jk> MyBean { |
| |
| <jc>// A read/write property.</jc> |
| <jk>public</jk> String getFoo() { <jk>return</jk> <js>"foo"</js>; } |
| <jk>public void</jk> setFoo(String <jv>foo</jv>) { ... } |
| |
| <jc>// A read-only property.</jc> |
| <jk>public</jk> String getBar() { <jk>return</jk> <js>"bar"</js>; } |
| } |
| |
| <jc>// Create a serializer that ignores bean properties without setters.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .beansRequireSettersForGetters() |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanp.html" title="annotation in org.apache.juneau.annotation"><code>@Beanp</code></a> annotation can be used on the getter to override this setting. |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on getters to ignore them as bean properties. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#beansRequireSettersForGetters()"><code>BeanConfig.beansRequireSettersForGetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beansRequireSettersForGetters()"><code>BeanContext.Builder.beansRequireSettersForGetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#beansRequireSettersForGetters()">beansRequireSettersForGetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="dictionaryOn(java.lang.Class,java.lang.Class...)">dictionaryOn</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.520">dictionaryOn</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.Class<?>... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#dictionaryOn(java.lang.Class,java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean dictionary. |
| |
| <p> |
| This is identical to <a href="../BeanContextable.Builder.html#beanDictionary(java.lang.Class...)"><code>BeanContextable.Builder.beanDictionary(Class...)</code></a>, but specifies a dictionary within the context of |
| a single class as opposed to globally. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// POJOs with @Bean(name) annotations.</jc> |
| <ja>@Bean</ja>(typeName=<js>"foo"</js>) |
| <jk>public class</jk> Foo {...} |
| <ja>@Bean</ja>(typeName=<js>"bar"</js>) |
| <jk>public class</jk> Bar {...} |
| |
| <jc>// A bean with a field with an indeterminate type.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>mySimpleField</jf>; |
| } |
| |
| <jc>// Create a parser and tell it which classes to try to resolve.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .dictionaryOn(MyBean.<jk>class</jk>, Foo.<jk>class</jk>, Bar.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Parse bean.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{mySimpleField:{_type:'foo',...}}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <p> |
| This is functionally equivalent to the <a href="../annotation/Bean.html#dictionary()"><code>Bean.dictionary()</code></a> annotation. |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#dictionary()"><code>Bean.dictionary()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beanDictionary(java.lang.Class...)"><code>BeanContext.Builder.beanDictionary(Class...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#dictionaryOn(java.lang.Class,java.lang.Class...)">dictionaryOn</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class that the dictionary values apply to.</dd> |
| <dd><code>values</code> - The new values for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="disableBeansRequireSomeProperties()">disableBeansRequireSomeProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.526">disableBeansRequireSomeProperties</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#disableBeansRequireSomeProperties()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Beans don't require at least one property. |
| |
| <p> |
| When enabled, then a Java class doesn't need to contain at least 1 property to be considered a bean. |
| Otherwise, the bean will be serialized as a string using the <code>Object.toString()</code> method. |
| |
| <p> |
| The <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation can be used on a class to override this setting when <jk>true</jk>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with no properties.</jc> |
| <jk>public class</jk> MyBean { |
| } |
| |
| <jc>// Create a serializer that serializes beans even if they have zero properties.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .disableBeansRequireSomeProperties() |
| .build(); |
| |
| <jc>// Produces: {}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotation can be used on the class to force it to be recognized as a bean class |
| even if it has no properties. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#disableBeansRequireSomeProperties()"><code>BeanConfig.disableBeansRequireSomeProperties()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#disableBeansRequireSomeProperties()"><code>BeanContext.Builder.disableBeansRequireSomeProperties()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#disableBeansRequireSomeProperties()">disableBeansRequireSomeProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="disableIgnoreMissingSetters()">disableIgnoreMissingSetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.532">disableIgnoreMissingSetters</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#disableIgnoreMissingSetters()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Don't silently ignore missing setters. |
| |
| <p> |
| When enabled, trying to set a value on a bean property without a setter will throw a <a href="../BeanRuntimeException.html" title="class in org.apache.juneau"><code>BeanRuntimeException</code></a>. |
| Otherwise, it will be silently ignored. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a property with a getter but not a setter.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public void</jk> getFoo() { |
| <jk>return</jk> <js>"foo"</js>; |
| } |
| } |
| |
| <jc>// Create a parser that throws an exception if a setter is not found but a getter is.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .disableIgnoreMissingSetters() |
| .build(); |
| |
| <jc>// Throws a ParseException.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on getters and fields to ignore them. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#disableIgnoreMissingSetters()"><code>BeanConfig.disableIgnoreMissingSetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#disableIgnoreMissingSetters()"><code>BeanContext.Builder.disableIgnoreMissingSetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#disableIgnoreMissingSetters()">disableIgnoreMissingSetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="disableIgnoreTransientFields()">disableIgnoreTransientFields</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.538">disableIgnoreTransientFields</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#disableIgnoreTransientFields()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Don't ignore transient fields. |
| |
| <p> |
| When enabled, methods and fields marked as <jk>transient</jk> will not be ignored as bean properties. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a transient field.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public transient</jk> String <jf>foo</jf> = <js>"foo"</js>; |
| } |
| |
| <jc>// Create a serializer that doesn't ignore transient fields.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .disableIgnoreTransientFields() |
| .build(); |
| |
| <jc>// Produces: {"foo":"foo"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanp.html" title="annotation in org.apache.juneau.annotation"><code>@Beanp</code></a> annotation can also be used on transient fields to keep them from being ignored. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#disableIgnoreTransientFields()"><code>BeanConfig.disableIgnoreTransientFields()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#disableIgnoreTransientFields()"><code>BeanContext.Builder.disableIgnoreTransientFields()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#disableIgnoreTransientFields()">disableIgnoreTransientFields</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="disableIgnoreUnknownNullBeanProperties()">disableIgnoreUnknownNullBeanProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.544">disableIgnoreUnknownNullBeanProperties</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#disableIgnoreUnknownNullBeanProperties()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Don't ignore unknown properties with null values. |
| |
| <p> |
| When enabled, trying to set a <jk>null</jk> value on a non-existent bean property will throw a <a href="../BeanRuntimeException.html" title="class in org.apache.juneau"><code>BeanRuntimeException</code></a>. |
| Otherwise it will be silently ignored. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>; |
| } |
| |
| <jc>// Create a parser that throws an exception on an unknown property even if the value being set is null.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .disableIgnoreUnknownNullBeanProperties() |
| .build(); |
| |
| <jc>// Throws a BeanRuntimeException wrapped in a ParseException on the unknown 'bar' property.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:null}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#disableIgnoreUnknownNullBeanProperties()"><code>BeanConfig.disableIgnoreUnknownNullBeanProperties()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#disableIgnoreUnknownNullBeanProperties()"><code>BeanContext.Builder.disableIgnoreUnknownNullBeanProperties()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#disableIgnoreUnknownNullBeanProperties()">disableIgnoreUnknownNullBeanProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="disableInterfaceProxies()">disableInterfaceProxies</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.550">disableInterfaceProxies</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#disableInterfaceProxies()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Don't use interface proxies. |
| |
| <p> |
| When enabled, interfaces will be instantiated as proxy classes through the use of an |
| <code>InvocationHandler</code> if there is no other way of instantiating them. |
| Otherwise, throws a <a href="../BeanRuntimeException.html" title="class in org.apache.juneau"><code>BeanRuntimeException</code></a>. |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#disableInterfaceProxies()"><code>BeanConfig.disableInterfaceProxies()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#disableInterfaceProxies()"><code>BeanContext.Builder.disableInterfaceProxies()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#disableInterfaceProxies()">disableInterfaceProxies</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="example(java.lang.Class,java.lang.Object)"> |
| <!-- --> |
| </a><a id="example(java.lang.Class,T)">example</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="typeParameters"><T></span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.556">example</a></span>​(<span class="arguments">java.lang.Class<T> pojoClass, |
| T o)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#example(java.lang.Class,T)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">POJO example. |
| |
| <p> |
| Specifies an example of the specified class. |
| |
| <p> |
| Examples are used in cases such as POJO examples in Swagger documents. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that excludes the 'foo' and 'bar' properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .example(MyBean.<jk>class</jk>, <jk>new</jk> MyBean().setFoo(<js>"foo"</js>).setBar(123)) |
| .build(); |
| </p> |
| |
| <p> |
| This is a shorthand method for the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(MarshalledAnnotation.<jsm>create</jsm>(<jv>pojoClass</jv>).example(Json5.<jsf>DEFAULT</jsf>.toString(<jv>object</jv>)).build()) |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>Using this method assumes the serialized form of the object is the same as that produced |
| by the default serializer. This may not be true based on settings or swaps on the constructed serializer. |
| </ul> |
| |
| <p> |
| POJO examples can also be defined on classes via the following: |
| <ul class='spaced-list'> |
| <li>The <a href="../annotation/Marshalled.html#example()"><code>Marshalled.example()</code></a> annotation on the class itself. |
| <li>A static field annotated with <a href="../annotation/Example.html" title="annotation in org.apache.juneau.annotation"><code>@Example</code></a>. |
| <li>A static method annotated with <a href="../annotation/Example.html" title="annotation in org.apache.juneau.annotation"><code>@Example</code></a> with zero arguments or one <a href="../BeanSession.html" title="class in org.apache.juneau"><code>BeanSession</code></a> argument. |
| <li>A static method with name <c>example</c> with no arguments or one <a href="../BeanSession.html" title="class in org.apache.juneau"><code>BeanSession</code></a> argument. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#example(java.lang.Class,T)">example</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The POJO class.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>pojoClass</code> - The POJO class.</dd> |
| <dd><code>o</code> - An instance of the POJO class used for examples.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="example(java.lang.Class,java.lang.String)">example</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="typeParameters"><T></span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.562">example</a></span>​(<span class="arguments">java.lang.Class<T> pojoClass, |
| java.lang.String json)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#example(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">POJO example. |
| |
| <p> |
| Specifies an example in JSON of the specified class. |
| |
| <p> |
| Examples are used in cases such as POJO examples in Swagger documents. |
| |
| <p> |
| Setting applies to specified class and all subclasses. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that excludes the 'foo' and 'bar' properties on the MyBean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .example(MyBean.<jk>class</jk>, <js>"{foo:'bar'}"</js>) |
| .build(); |
| </p> |
| |
| <p> |
| This is a shorthand method for the following code: |
| <p class='bjava'> |
| <jv>builder</jv>.annotations(MarshalledAnnotation.<jsm>create</jsm>(<jv>pojoClass</jv>).example(<jv>json</jv>).build()) |
| </p> |
| |
| <p> |
| POJO examples can also be defined on classes via the following: |
| <ul class='spaced-list'> |
| <li>A static field annotated with <a href="../annotation/Example.html" title="annotation in org.apache.juneau.annotation"><code>@Example</code></a>. |
| <li>A static method annotated with <a href="../annotation/Example.html" title="annotation in org.apache.juneau.annotation"><code>@Example</code></a> with zero arguments or one <a href="../BeanSession.html" title="class in org.apache.juneau"><code>BeanSession</code></a> argument. |
| <li>A static method with name <c>example</c> with no arguments or one <a href="../BeanSession.html" title="class in org.apache.juneau"><code>BeanSession</code></a> argument. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Marshalled.html#example()"><code>Marshalled.example()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#example(java.lang.Class,java.lang.String)">example</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The POJO class type.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>pojoClass</code> - The POJO class.</dd> |
| <dd><code>json</code> - The JSON 5 representation of the example.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="findFluentSetters()">findFluentSetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.568">findFluentSetters</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#findFluentSetters()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Find fluent setters. |
| |
| <p> |
| When enabled, fluent setters are detected on beans during parsing. |
| |
| <p> |
| Fluent setters must have the following attributes: |
| <ul> |
| <li>Public. |
| <li>Not static. |
| <li>Take in one parameter. |
| <li>Return the bean itself. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a fluent setter.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> MyBean foo(String <jv>value</jv>) {...} |
| } |
| |
| <jc>// Create a parser that finds fluent setters.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .findFluentSetters() |
| .build(); |
| |
| <jc>// Parse into bean using fluent setter.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Beanp.html" title="annotation in org.apache.juneau.annotation"><code>@Beanp</code></a> annotation can also be used on methods to individually identify them as fluent setters. |
| <li class='note'>The <a href="../annotation/Bean.html#findFluentSetters()"><code>@Bean.fluentSetters()</code></a> annotation can also be used on classes to specify to look for fluent setters. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#findFluentSetters()"><code>Bean.findFluentSetters()</code></a> |
| <li class='ja'><a href="../annotation/BeanConfig.html#findFluentSetters()"><code>BeanConfig.findFluentSetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#findFluentSetters()"><code>BeanContext.Builder.findFluentSetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#findFluentSetters()">findFluentSetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="findFluentSetters(java.lang.Class)">findFluentSetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.574">findFluentSetters</a></span>​(<span class="arguments">java.lang.Class<?> on)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#findFluentSetters(java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Find fluent setters. |
| |
| <p> |
| Identical to <a href="../BeanContextable.Builder.html#findFluentSetters()"><code>BeanContextable.Builder.findFluentSetters()</code></a> but enables it on a specific class only. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a fluent setter.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> MyBean foo(String <jv>value</jv>) {...} |
| } |
| |
| <jc>// Create a parser that finds fluent setters.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .findFluentSetters(MyBean.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Parse into bean using fluent setter.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>This method is functionally equivalent to using the <a href="../annotation/Bean.html#findFluentSetters()"><code>Bean.findFluentSetters()</code></a> annotation. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#findFluentSetters()"><code>Bean.findFluentSetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#findFluentSetters()"><code>BeanContext.Builder.findFluentSetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#findFluentSetters(java.lang.Class)">findFluentSetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class that this applies to.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreInvocationExceptionsOnGetters()">ignoreInvocationExceptionsOnGetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.580">ignoreInvocationExceptionsOnGetters</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#ignoreInvocationExceptionsOnGetters()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Ignore invocation errors on getters. |
| |
| <p> |
| When enabled, errors thrown when calling bean getter methods will silently be ignored. |
| Otherwise, a <code>BeanRuntimeException</code> is thrown. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a property that throws an exception.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String getFoo() { |
| <jk>throw new</jk> RuntimeException(<js>"foo"</js>); |
| } |
| } |
| |
| <jc>// Create a serializer that ignores bean getter exceptions.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .ingoreInvocationExceptionsOnGetters() |
| .build(); |
| |
| <jc>// Exception is ignored.</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#ignoreInvocationExceptionsOnGetters()"><code>BeanConfig.ignoreInvocationExceptionsOnGetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#ignoreInvocationExceptionsOnGetters()"><code>BeanContext.Builder.ignoreInvocationExceptionsOnGetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreInvocationExceptionsOnGetters()">ignoreInvocationExceptionsOnGetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreInvocationExceptionsOnSetters()">ignoreInvocationExceptionsOnSetters</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.586">ignoreInvocationExceptionsOnSetters</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#ignoreInvocationExceptionsOnSetters()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Ignore invocation errors on setters. |
| |
| <p> |
| When enabled, errors thrown when calling bean setter methods will silently be ignored. |
| Otherwise, a <code>BeanRuntimeException</code> is thrown. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a property that throws an exception.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public void</jk> setFoo(String <jv>foo</jv>) { |
| <jk>throw new</jk> RuntimeException(<js>"foo"</js>); |
| } |
| } |
| |
| <jc>// Create a parser that ignores bean setter exceptions.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .ignoreInvocationExceptionsOnSetters() |
| .build(); |
| |
| <jc>// Exception is ignored.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#ignoreInvocationExceptionsOnSetters()"><code>BeanConfig.ignoreInvocationExceptionsOnSetters()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#ignoreInvocationExceptionsOnSetters()"><code>BeanContext.Builder.ignoreInvocationExceptionsOnSetters()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreInvocationExceptionsOnSetters()">ignoreInvocationExceptionsOnSetters</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreUnknownBeanProperties()">ignoreUnknownBeanProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.592">ignoreUnknownBeanProperties</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#ignoreUnknownBeanProperties()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Ignore unknown properties. |
| |
| <p> |
| When enabled, trying to set a value on a non-existent bean property will silently be ignored. |
| Otherwise, a <code>BeanRuntimeException</code> is thrown. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf>; |
| } |
| |
| <jc>// Create a parser that ignores missing bean properties.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .ignoreUnknownBeanProperties() |
| .build(); |
| |
| <jc>// Doesn't throw an exception on unknown 'bar' property.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"{foo:'foo',bar:'bar'}"</js>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#ignoreUnknownBeanProperties()"><code>BeanConfig.ignoreUnknownBeanProperties()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#ignoreUnknownBeanProperties()"><code>BeanContext.Builder.ignoreUnknownBeanProperties()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreUnknownBeanProperties()">ignoreUnknownBeanProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreUnknownEnumValues()">ignoreUnknownEnumValues</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.598">ignoreUnknownEnumValues</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#ignoreUnknownEnumValues()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Ignore unknown enum values. |
| |
| <p> |
| When enabled, unknown enum values are set to <jk>null</jk> instead of throwing a parse exception. |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#ignoreUnknownEnumValues()"><code>BeanConfig.ignoreUnknownEnumValues()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#ignoreUnknownEnumValues()"><code>BeanContext.Builder.ignoreUnknownEnumValues()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreUnknownEnumValues()">ignoreUnknownEnumValues</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="implClass(java.lang.Class,java.lang.Class)">implClass</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.604">implClass</a></span>​(<span class="arguments">java.lang.Class<?> interfaceClass, |
| java.lang.Class<?> implClass)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#implClass(java.lang.Class,java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Implementation classes. |
| |
| <p> |
| For interfaces and abstract classes this method can be used to specify an implementation class for the |
| interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a |
| parse). |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean interface.</jc> |
| <jk>public interface</jk> MyBean { |
| ... |
| } |
| |
| <jc>// A bean implementation.</jc> |
| <jk>public class</jk> MyBeanImpl <jk>implements</jk> MyBean { |
| ... |
| } |
| |
| <jc>// Create a parser that instantiates MyBeanImpls when parsing MyBeans.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .implClass(MyBean.<jk>class</jk>, MyBeanImpl.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Instantiates a MyBeanImpl,</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"..."</js>, MyBean.<jk>class</jk>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#implClass(java.lang.Class,java.lang.Class)">implClass</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>interfaceClass</code> - The interface class.</dd> |
| <dd><code>implClass</code> - The implementation class.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="implClasses(java.util.Map)">implClasses</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.610">implClasses</a></span>​(<span class="arguments">java.util.Map<java.lang.Class<?>,​java.lang.Class<?>> values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#implClasses(java.util.Map)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Implementation classes. |
| |
| <p> |
| For interfaces and abstract classes this method can be used to specify an implementation class for the |
| interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a |
| parse). |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public interface</jk> MyBean { |
| ... |
| } |
| |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBeanImpl <jk>implements</jk> MyBean { |
| ... |
| } |
| |
| <jc>// Create a parser that instantiates MyBeanImpls when parsing MyBeans.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .implClasses(AMap.<jsm>of</jsm>(MyBean.<jk>class</jk>, MyBeanImpl.<jk>class</jk>)) |
| .build(); |
| |
| <jc>// Instantiates a MyBeanImpl,</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<js>"..."</js>, MyBean.<jk>class</jk>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#implClasses(java.util.Map)">implClasses</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="interfaceClass(java.lang.Class,java.lang.Class)">interfaceClass</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.616">interfaceClass</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.Class<?> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#interfaceClass(java.lang.Class,java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Identifies a class to be used as the interface class for the specified class and all subclasses. |
| |
| <p> |
| When specified, only the list of properties defined on the interface class will be used during serialization. |
| Additional properties on subclasses will be ignored. |
| |
| <p class='bjava'> |
| <jc>// Parent class or interface</jc> |
| <jk>public abstract class</jk> A { |
| <jk>public</jk> String <jf>foo</jf> = <js>"foo"</js>; |
| } |
| |
| <jc>// Sub class</jc> |
| <jk>public class</jk> A1 <jk>extends</jk> A { |
| <jk>public</jk> String <jf>bar</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Create a serializer and define our interface class mapping.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .interfaceClass(A1.<jk>class</jk>, A.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces "{"foo":"foo"}"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> A1()); |
| </p> |
| |
| <p> |
| This annotation can be used on the parent class so that it filters to all child classes, or can be set |
| individually on the child classes. |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html#interfaceClass()"><code>@Bean(interfaceClass)</code></a> annotation is the equivalent annotation-based solution. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#interfaceClass(java.lang.Class,java.lang.Class)">interfaceClass</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class that the interface class applies to.</dd> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="interfaces(java.lang.Class...)">interfaces</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.622">interfaces</a></span>​(<span class="arguments">java.lang.Class<?>... value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#interfaces(java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Identifies a set of interfaces. |
| |
| <p> |
| When specified, only the list of properties defined on the interface class will be used during serialization |
| of implementation classes. Additional properties on subclasses will be ignored. |
| |
| <p class='bjava'> |
| <jc>// Parent class or interface</jc> |
| <jk>public abstract class</jk> A { |
| <jk>public</jk> String <jf>foo</jf> = <js>"foo"</js>; |
| } |
| |
| <jc>// Sub class</jc> |
| <jk>public class</jk> A1 <jk>extends</jk> A { |
| <jk>public</jk> String <jf>bar</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Create a serializer and define our interface class mapping.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .interfaces(A.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces "{"foo":"foo"}"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> A1()); |
| </p> |
| |
| <p> |
| This annotation can be used on the parent class so that it filters to all child classes, or can be set |
| individually on the child classes. |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html#interfaceClass()"><code>@Bean(interfaceClass)</code></a> annotation is the equivalent annotation-based solution. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#interfaces(java.lang.Class...)">interfaces</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="locale(java.util.Locale)">locale</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.628">locale</a></span>​(<span class="arguments">java.util.Locale value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#locale(java.util.Locale)">BeanContextable.Builder</a></code></span></div> |
| <div class="block"><i><l>Context</l> configuration property: </i> Locale. |
| |
| <p> |
| Specifies the default locale for serializer and parser sessions when not specified via <a href="../BeanSession.Builder.html#locale(java.util.Locale)"><code>BeanSession.Builder.locale(Locale)</code></a>. |
| Typically used for POJO swaps that need to deal with locales such as swaps that convert <l>Date</l> and <l>Calendar</l> |
| objects to strings by accessing it via the session passed into the <a href="../swap/ObjectSwap.html#swap(org.apache.juneau.BeanSession,T)"><code>ObjectSwap.swap(BeanSession, Object)</code></a> and |
| <a href="../swap/ObjectSwap.html#unswap(org.apache.juneau.BeanSession,S,org.apache.juneau.ClassMeta,java.lang.String)"><code>ObjectSwap.unswap(BeanSession, Object, ClassMeta, String)</code></a> methods. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Define a POJO swap that skips serializing beans if we're in the UK.</jc> |
| <jk>public class</jk> MyBeanSwap <jk>extends</jk> StringSwap<MyBean> { |
| <ja>@Override</ja> |
| <jk>public</jk> String swap(BeanSession <jv>session</jv>, MyBean <jv>bean</jv>) <jk>throws</jk> Exception { |
| <jk>if</jk> (<jv>session</jv>.getLocale().equals(Locale.<jsf>UK</jsf>)) |
| <jk>return null</jk>; |
| <jk>return</jk> <jv>bean</jv>.toString(); |
| } |
| } |
| |
| <jc>// Create a serializer that uses the specified locale if it's not passed in through session args.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .locale(Locale.<jsf>UK</jsf>) |
| .swaps(MyBeanSwap.<jk>class</jk>) |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#locale()"><code>BeanConfig.locale()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#locale(java.util.Locale)"><code>BeanContext.Builder.locale(Locale)</code></a> |
| <li class='jm'><a href="../BeanSession.Builder.html#locale(java.util.Locale)"><code>BeanSession.Builder.locale(Locale)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#locale(java.util.Locale)">locale</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="mediaType(org.apache.juneau.MediaType)">mediaType</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.634">mediaType</a></span>​(<span class="arguments"><a href="../MediaType.html" title="class in org.apache.juneau">MediaType</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#mediaType(org.apache.juneau.MediaType)">BeanContextable.Builder</a></code></span></div> |
| <div class="block"><i><l>Context</l> configuration property: </i> Media type. |
| |
| <p> |
| Specifies the default media type for serializer and parser sessions when not specified via <a href="../BeanSession.Builder.html#mediaType(org.apache.juneau.MediaType)"><code>BeanSession.Builder.mediaType(MediaType)</code></a>. |
| Typically used for POJO swaps that need to serialize the same POJO classes differently depending on |
| the specific requested media type. For example, a swap could handle a request for media types <js>"application/json"</js> |
| and <js>"application/json+foo"</js> slightly differently even though they're both being handled by the same JSON |
| serializer or parser. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Define a POJO swap that skips serializing beans if the media type is application/json.</jc> |
| <jk>public class</jk> MyBeanSwap <jk>extends</jk> StringSwap<MyBean> { |
| <ja>@Override</ja> |
| <jk>public</jk> String swap(BeanSession <jv>session</jv>, MyBean <jv>bean</jv>) <jk>throws</jk> Exception { |
| <jk>if</jk> (<jv>session</jv>.getMediaType().equals(<js>"application/json"</js>)) |
| <jk>return null</jk>; |
| <jk>return</jk> <jv>bean</jv>.toString(); |
| } |
| } |
| |
| <jc>// Create a serializer that uses the specified media type if it's not passed in through session args.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .mediaType(MediaType.<jsf>JSON</jsf>) |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#mediaType()"><code>BeanConfig.mediaType()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#mediaType(org.apache.juneau.MediaType)"><code>BeanContext.Builder.mediaType(MediaType)</code></a> |
| <li class='jm'><a href="../BeanSession.Builder.html#mediaType(org.apache.juneau.MediaType)"><code>BeanSession.Builder.mediaType(MediaType)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#mediaType(org.apache.juneau.MediaType)">mediaType</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="notBeanClasses(java.lang.Class...)">notBeanClasses</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.640">notBeanClasses</a></span>​(<span class="arguments">java.lang.Class<?>... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#notBeanClasses(java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean class exclusions. |
| |
| <p> |
| List of classes that should not be treated as beans even if they appear to be bean-like. |
| Not-bean classes are converted to <c>Strings</c> during serialization. |
| |
| <p> |
| Values can consist of any of the following types: |
| <ul> |
| <li>Classes. |
| <li>Arrays and collections of classes. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| |
| <jk>public</jk> String toString() { |
| <jk>return</jk> <js>"baz"</js>; |
| } |
| } |
| |
| <jc>// Create a serializer that doesn't treat MyBean as a bean class.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .notBeanClasses(MyBean.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces "baz" instead of {"foo":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>@BeanIgnore</code></a> annotation can also be used on classes to prevent them from being recognized as beans. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanIgnore.html" title="annotation in org.apache.juneau.annotation"><code>BeanIgnore</code></a> |
| <li class='ja'><a href="../annotation/BeanConfig.html#notBeanClasses()"><code>BeanConfig.notBeanClasses()</code></a> |
| <li class='jf'><a href="../BeanContext.Builder.html#notBeanClasses()"><code>BeanContext.Builder.notBeanClasses()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#notBeanClasses(java.lang.Class...)">notBeanClasses</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting. |
| <br>Values can consist of any of the following types: |
| <ul> |
| <li>Classes. |
| <li>Arrays and collections of classes. |
| </ul></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="notBeanPackages(java.lang.String...)">notBeanPackages</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.646">notBeanPackages</a></span>​(<span class="arguments">java.lang.String... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#notBeanPackages(java.lang.String...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean package exclusions. |
| |
| <p> |
| Used as a convenient way of defining the <a href="../BeanContext.Builder.html#notBeanClasses(java.lang.Class...)"><code>BeanContext.Builder.notBeanClasses(Class...)</code></a> property for entire packages. |
| Any classes within these packages will be serialized to strings using <code>Object.toString()</code>. |
| |
| <p> |
| Note that you can specify suffix patterns to include all subpackages. |
| |
| <p> |
| Values can consist of any of the following types: |
| <ul> |
| <li>Strings. |
| <li>Arrays and collections of strings. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that ignores beans in the specified packages.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .notBeanPackages(<js>"org.apache.foo"</js>, <js>"org.apache.bar.*"</js>) |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../BeanContext.Builder.html#notBeanPackages(java.lang.String...)"><code>BeanContext.Builder.notBeanPackages(String...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#notBeanPackages(java.lang.String...)">notBeanPackages</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting. |
| <br>Values can consist of any of the following types: |
| <ul> |
| <li><code>Package</code> objects. |
| <li>Strings. |
| <li>Arrays and collections of anything in this list. |
| </ul></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="propertyNamer(java.lang.Class)">propertyNamer</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.652">propertyNamer</a></span>​(<span class="arguments">java.lang.Class<? extends <a href="../PropertyNamer.html" title="interface in org.apache.juneau">PropertyNamer</a>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#propertyNamer(java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property namer |
| |
| <p> |
| The class to use for calculating bean property names. |
| |
| <p> |
| Predefined classes: |
| <ul> |
| <li><a href="../BasicPropertyNamer.html" title="class in org.apache.juneau"><code>BasicPropertyNamer</code></a> - Default. |
| <li><a href="../PropertyNamerDLC.html" title="class in org.apache.juneau"><code>PropertyNamerDLC</code></a> - Dashed-lower-case names. |
| <li><a href="../PropertyNamerULC.html" title="class in org.apache.juneau"><code>PropertyNamerULC</code></a> - Dashed-upper-case names. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>fooBarBaz</jf> = <js>"fooBarBaz"</js>; |
| } |
| |
| <jc>// Create a serializer that uses Dashed-Lower-Case property names.</jc> |
| <jc>// (e.g. "foo-bar-baz" instead of "fooBarBaz")</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .propertyNamer(PropertyNamerDLC.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"foo-bar-baz":"fooBarBaz"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../BeanContext.Builder.html#propertyNamer(java.lang.Class)"><code>BeanContext.Builder.propertyNamer(Class)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#propertyNamer(java.lang.Class)">propertyNamer</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../BasicPropertyNamer.html" title="class in org.apache.juneau"><code>BasicPropertyNamer</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="propertyNamer(java.lang.Class,java.lang.Class)">propertyNamer</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.658">propertyNamer</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.Class<? extends <a href="../PropertyNamer.html" title="interface in org.apache.juneau">PropertyNamer</a>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#propertyNamer(java.lang.Class,java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean property namer |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#propertyNamer(java.lang.Class)"><code>BeanContextable.Builder.propertyNamer(Class)</code></a> but allows you to specify a namer for a specific class. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with a single property.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>fooBarBaz</jf> = <js>"fooBarBaz"</js>; |
| } |
| |
| <jc>// Create a serializer that uses Dashed-Lower-Case property names for the MyBean class only.</jc> |
| <jc>// (e.g. "foo-bar-baz" instead of "fooBarBaz")</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .propertyNamer(MyBean.<jk>class</jk>, PropertyNamerDLC.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"foo-bar-baz":"fooBarBaz"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#propertyNamer()"><code>Bean(propertyNamer)</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#propertyNamer(java.lang.Class)"><code>BeanContext.Builder.propertyNamer(Class)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#propertyNamer(java.lang.Class,java.lang.Class)">propertyNamer</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class that the namer applies to.</dd> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <a href="../BasicPropertyNamer.html" title="class in org.apache.juneau"><code>BasicPropertyNamer</code></a>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortProperties()">sortProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.664">sortProperties</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#sortProperties()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Sort bean properties. |
| |
| <p> |
| When enabled, all bean properties will be serialized and access in alphabetical order. |
| Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor. |
| On IBM JVMs, the bean properties are ordered based on their ordering in the Java file. |
| On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs). |
| |
| <p> |
| this setting is disabled by default so that IBM JVM users don't have to use <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotations |
| to force bean properties to be in a particular order and can just alter the order of the fields/methods |
| in the Java file. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>c</jf> = <js>"1"</js>; |
| <jk>public</jk> String <jf>b</jf> = <js>"2"</js>; |
| <jk>public</jk> String <jf>a</jf> = <js>"3"</js>; |
| } |
| |
| <jc>// Create a serializer that sorts bean properties.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .sortProperties() |
| .build(); |
| |
| <jc>// Produces: {"a":"3","b":"2","c":"1"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Bean.html#sort()"><code>@Bean.sort()</code></a> annotation can also be used to sort properties on just a single class. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../BeanContext.Builder.html#sortProperties()"><code>BeanContext.Builder.sortProperties()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortProperties()">sortProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortProperties(java.lang.Class...)">sortProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.670">sortProperties</a></span>​(<span class="arguments">java.lang.Class<?>... on)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#sortProperties(java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Sort bean properties. |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#sortProperties()"><code>BeanContextable.Builder.sortProperties()</code></a> but allows you to specify individual bean classes instead of globally. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// A bean with 3 properties.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>c</jf> = <js>"1"</js>; |
| <jk>public</jk> String <jf>b</jf> = <js>"2"</js>; |
| <jk>public</jk> String <jf>a</jf> = <js>"3"</js>; |
| } |
| |
| <jc>// Create a serializer that sorts properties on MyBean.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .sortProperties(MyBean.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"a":"3","b":"2","c":"1"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#sort()"><code>Bean(sort)</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#sortProperties()"><code>BeanContext.Builder.sortProperties()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortProperties(java.lang.Class...)">sortProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The bean classes to sort properties on.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="stopClass(java.lang.Class,java.lang.Class)">stopClass</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.676">stopClass</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.Class<?> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#stopClass(java.lang.Class,java.lang.Class)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Identifies a stop class for the annotated class. |
| |
| <p> |
| Identical in purpose to the stop class specified by <code>Introspector.getBeanInfo(Class, Class)</code>. |
| Any properties in the stop class or in its base classes will be ignored during analysis. |
| |
| <p> |
| For example, in the following class hierarchy, instances of <c>C3</c> will include property <c>p3</c>, |
| but not <c>p1</c> or <c>p2</c>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jk>public class</jk> C1 { |
| <jk>public int</jk> getP1(); |
| } |
| |
| <jk>public class</jk> C2 <jk>extends</jk> C1 { |
| <jk>public int</jk> getP2(); |
| } |
| |
| <jk>public class</jk> C3 <jk>extends</jk> C2 { |
| <jk>public int</jk> getP3(); |
| } |
| |
| <jc>// Create a serializer specifies a stop class for C3.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .stopClass(C3.<jk>class</jk>, C2.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"p3":"..."}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> C3()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#stopClass(java.lang.Class,java.lang.Class)">stopClass</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class on which the stop class is being applied.</dd> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction)">swap</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="typeParameters"><T,​ |
| S></span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.682">swap</a></span>​(<span class="arguments">java.lang.Class<T> normalClass, |
| java.lang.Class<S> swappedClass, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><T,​S> swapFunction)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">A shortcut for defining a <a href="../swap/FunctionalSwap.html" title="class in org.apache.juneau.swap"><code>FunctionalSwap</code></a>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that performs a custom format for Date objects.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .swap(Date.<jk>class</jk>, String.<jk>class</jk>, <jv>x</jv> -> <jsm>format</jsm>(<jv>x</jv>)) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction)">swap</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The object type being swapped out.</dd> |
| <dd><code>S</code> - The object type being swapped in.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>normalClass</code> - The object type being swapped out.</dd> |
| <dd><code>swappedClass</code> - The object type being swapped in.</dd> |
| <dd><code>swapFunction</code> - The function to convert the object.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction,org.apache.juneau.utils.ThrowingFunction)">swap</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="typeParameters"><T,​ |
| S></span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.688">swap</a></span>​(<span class="arguments">java.lang.Class<T> normalClass, |
| java.lang.Class<S> swappedClass, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><T,​S> swapFunction, |
| <a href="../utils/ThrowingFunction.html" title="interface in org.apache.juneau.utils">ThrowingFunction</a><S,​T> unswapFunction)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction,org.apache.juneau.utils.ThrowingFunction)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">A shortcut for defining a <a href="../swap/FunctionalSwap.html" title="class in org.apache.juneau.swap"><code>FunctionalSwap</code></a>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that performs a custom format for Date objects.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .swap(Date.<jk>class</jk>, String.<jk>class</jk>, <jv>x</jv> -> <jsm>format</jsm>(<jv>x</jv>), <jv>x</jv> -> <jsm>parse</jsm>(<jv>x</jv>)) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#swap(java.lang.Class,java.lang.Class,org.apache.juneau.utils.ThrowingFunction,org.apache.juneau.utils.ThrowingFunction)">swap</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The object type being swapped out.</dd> |
| <dd><code>S</code> - The object type being swapped in.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>normalClass</code> - The object type being swapped out.</dd> |
| <dd><code>swappedClass</code> - The object type being swapped in.</dd> |
| <dd><code>swapFunction</code> - The function to convert the object during serialization.</dd> |
| <dd><code>unswapFunction</code> - The function to convert the object during parsing.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="swaps(java.lang.Class...)">swaps</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.694">swaps</a></span>​(<span class="arguments">java.lang.Class<?>... values)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#swaps(java.lang.Class...)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Java object swaps. |
| |
| <p> |
| Swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization, |
| and "swap in" the non-serializable class during parsing. |
| |
| <p> |
| An example of a swap would be a <c>Calendar</c> object that gets swapped out for an ISO8601 string. |
| |
| <p> |
| Multiple swaps can be associated with a single class. |
| When multiple swaps are applicable to the same class, the media type pattern defined by |
| <a href="../swap/ObjectSwap.html#forMediaTypes()"><code>ObjectSwap.forMediaTypes()</code></a> or <a href="../annotation/Swap.html#mediaTypes()"><code>@Swap(mediaTypes)</code></a> are used to come up with the best match. |
| |
| <p> |
| Values can consist of any of the following types: |
| <ul> |
| <li>Any subclass of <a href="../swap/ObjectSwap.html" title="class in org.apache.juneau.swap"><code>ObjectSwap</code></a>. |
| <li>Any instance of <a href="../swap/ObjectSwap.html" title="class in org.apache.juneau.swap"><code>ObjectSwap</code></a>. |
| <li>Any surrogate class. A shortcut for defining a <a href="../swap/SurrogateSwap.html" title="class in org.apache.juneau.swap"><code>SurrogateSwap</code></a>. |
| <li>Any array or collection of the objects above. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Sample swap for converting Dates to ISO8601 strings.</jc> |
| <jk>public class</jk> MyDateSwap <jk>extends</jk> StringSwap<Date> { |
| <jc>// ISO8601 formatter.</jc> |
| <jk>private</jk> DateFormat <jf>format</jf> = <jk>new</jk> SimpleDateFormat(<js>"yyyy-MM-dd'T'HH:mm:ssZ"</js>); |
| |
| <ja>@Override</ja> |
| <jk>public</jk> String swap(BeanSession <jv>session</jv>, Date <jv>date</jv>) { |
| <jk>return</jk> <jf>format</jf>.format(<jv>date</jv>); |
| } |
| |
| <ja>@Override</ja> |
| <jk>public</jk> Date unswap(BeanSession <jv>session</jv>, String <jv>string</jv>, ClassMeta <jv>hint</jv>) <jk>throws</jk> Exception { |
| <jk>return</jk> <jf>format</jf>.parse(<jv>string</jv>); |
| } |
| } |
| |
| <jc>// Sample bean with a Date field.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Date <jf>date</jf> = <jk>new</jk> Date(112, 2, 3, 4, 5, 6); |
| } |
| |
| <jc>// Create a serializer that uses our date swap.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .swaps(MyDateSwap.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces: {"date":"2012-03-03T04:05:06-0500"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Create a serializer that uses our date swap.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .swaps(MyDateSwap.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Use our parser to parse a bean.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<jv>json</jv>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>The <a href="../annotation/Swap.html" title="annotation in org.apache.juneau.annotation"><code>@Swap</code></a> annotation can also be used on classes to identify swaps for the class. |
| <li class='note'>The <a href="../annotation/Swap.html" title="annotation in org.apache.juneau.annotation"><code>@Swap</code></a> annotation can also be used on bean methods and fields to identify swaps for values of those bean properties. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='jf'><a href="../BeanContext.Builder.html#swaps(java.lang.Class...)"><code>BeanContext.Builder.swaps(Class...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#swaps(java.lang.Class...)">swaps</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values to add to this setting. |
| <br>Values can consist of any of the following types: |
| <ul> |
| <li>Any subclass of <a href="../swap/ObjectSwap.html" title="class in org.apache.juneau.swap"><code>ObjectSwap</code></a>. |
| <li>Any surrogate class. A shortcut for defining a <a href="../swap/SurrogateSwap.html" title="class in org.apache.juneau.swap"><code>SurrogateSwap</code></a>. |
| <li>Any array or collection of the objects above. |
| </ul></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="timeZone(java.util.TimeZone)">timeZone</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.700">timeZone</a></span>​(<span class="arguments">java.util.TimeZone value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#timeZone(java.util.TimeZone)">BeanContextable.Builder</a></code></span></div> |
| <div class="block"><i><l>Context</l> configuration property: </i> TimeZone. |
| |
| <p> |
| Specifies the default time zone for serializer and parser sessions when not specified via <a href="../BeanSession.Builder.html#timeZone(java.util.TimeZone)"><code>BeanSession.Builder.timeZone(TimeZone)</code></a>. |
| Typically used for POJO swaps that need to deal with timezones such as swaps that convert <l>Date</l> and <l>Calendar</l> |
| objects to strings by accessing it via the session passed into the <a href="../swap/ObjectSwap.html#swap(org.apache.juneau.BeanSession,T)"><code>ObjectSwap.swap(BeanSession, Object)</code></a> and |
| <a href="../swap/ObjectSwap.html#unswap(org.apache.juneau.BeanSession,S,org.apache.juneau.ClassMeta,java.lang.String)"><code>ObjectSwap.unswap(BeanSession, Object, ClassMeta, String)</code></a> methods. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Define a POJO swap that skips serializing beans if the time zone is GMT.</jc> |
| <jk>public class</jk> MyBeanSwap <jk>extends</jk> StringSwap<MyBean> { |
| <ja>@Override</ja> |
| <jk>public</jk> String swap(BeanSession <jv>session</jv>, MyBean <jv>bean</jv>) <jk>throws</jk> Exception { |
| <jk>if</jk> (<jv>session</jv>.getTimeZone().equals(TimeZone.<jsf>GMT</jsf>)) |
| <jk>return null</jk>; |
| <jk>return</jk> <jv>bean</jv>.toString(); |
| } |
| } |
| |
| <jc>// Create a serializer that uses GMT if the timezone is not specified in the session args.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .timeZone(TimeZone.<jsf>GMT</jsf>) |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/BeanConfig.html#timeZone()"><code>BeanConfig.timeZone()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#timeZone(java.util.TimeZone)"><code>BeanContext.Builder.timeZone(TimeZone)</code></a> |
| <li class='jm'><a href="../BeanSession.Builder.html#timeZone(java.util.TimeZone)"><code>BeanSession.Builder.timeZone(TimeZone)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#timeZone(java.util.TimeZone)">timeZone</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="typeName(java.lang.Class,java.lang.String)">typeName</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.706">typeName</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.String value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#typeName(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">An identifying name for this class. |
| |
| <p> |
| The name is used to identify the class type during parsing when it cannot be inferred through reflection. |
| For example, if a bean property is of type <c>Object</c>, then the serializer will add the name to the |
| output so that the class can be determined during parsing. |
| |
| <p> |
| It is also used to specify element names in XML. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Use _type='mybean' to identify this bean.</jc> |
| <jk>public class</jk> MyBean {...} |
| |
| <jc>// Create a serializer and specify the type name..</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .typeName(MyBean.<jk>class</jk>, <js>"mybean"</js>) |
| .build(); |
| |
| <jc>// Produces: {"_type":"mybean",...}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'>Equivalent to the <a href="../annotation/Bean.html#typeName()"><code>Bean(typeName)</code></a> annotation. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='jc'><a href="../annotation/Bean.html#typeName()"><code>Bean(typeName)</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#beanDictionary(java.lang.Class...)"><code>BeanContext.Builder.beanDictionary(Class...)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#typeName(java.lang.Class,java.lang.String)">typeName</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class the type name is being defined on.</dd> |
| <dd><code>value</code> - The new value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="typePropertyName(java.lang.String)">typePropertyName</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.712">typePropertyName</a></span>​(<span class="arguments">java.lang.String value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#typePropertyName(java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean type property name. |
| |
| <p> |
| This specifies the name of the bean property used to store the dictionary name of a bean type so that the |
| parser knows the data type to reconstruct. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// POJOs with @Bean(name) annotations.</jc> |
| <ja>@Bean</ja>(typeName=<js>"foo"</js>) |
| <jk>public class</jk> Foo {...} |
| <ja>@Bean</ja>(typeName=<js>"bar"</js>) |
| <jk>public class</jk> Bar {...} |
| |
| <jc>// Create a serializer that uses 't' instead of '_type' for dictionary names.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .typePropertyName(<js>"t"</js>) |
| .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Create a serializer that uses 't' instead of '_type' for dictionary names.</jc> |
| ReaderParser <jv>parser</jv> = JsonParser |
| .<jsm>create</jsm>() |
| .typePropertyName(<js>"t"</js>) |
| .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>) |
| .build(); |
| |
| <jc>// A bean with a field with an indeterminate type.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>mySimpleField</jf>; |
| } |
| |
| <jc>// Produces "{mySimpleField:{t:'foo',...}}".</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Parse bean.</jc> |
| MyBean <jv>bean</jv> = <jv>parser</jv>.parse(<jv>json</jv>, MyBean.<jk>class</jk>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#typePropertyName()"><code>Bean.typePropertyName()</code></a> |
| <li class='ja'><a href="../annotation/BeanConfig.html#typePropertyName()"><code>BeanConfig.typePropertyName()</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#typePropertyName(java.lang.String)"><code>BeanContext.Builder.typePropertyName(String)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#typePropertyName(java.lang.String)">typePropertyName</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <js>"_type"</js>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="typePropertyName(java.lang.Class,java.lang.String)">typePropertyName</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.718">typePropertyName</a></span>​(<span class="arguments">java.lang.Class<?> on, |
| java.lang.String value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#typePropertyName(java.lang.Class,java.lang.String)">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Bean type property name. |
| |
| <p> |
| Same as <a href="../BeanContextable.Builder.html#typePropertyName(java.lang.String)"><code>BeanContextable.Builder.typePropertyName(String)</code></a> except targets a specific bean class instead of globally. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// POJOs with @Bean(name) annotations.</jc> |
| <ja>@Bean</ja>(typeName=<js>"foo"</js>) |
| <jk>public class</jk> Foo {...} |
| <ja>@Bean</ja>(typeName=<js>"bar"</js>) |
| <jk>public class</jk> Bar {...} |
| |
| <jc>// A bean with a field with an indeterminate type.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>mySimpleField</jf>; |
| } |
| |
| <jc>// Create a serializer that uses 't' instead of '_type' for dictionary names.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .typePropertyName(MyBean.<jk>class</jk>, <js>"t"</js>) |
| .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Produces "{mySimpleField:{t:'foo',...}}".</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='ja'><a href="../annotation/Bean.html#typePropertyName()"><code>Bean(typePropertyName)</code></a> |
| <li class='jm'><a href="../BeanContext.Builder.html#typePropertyName(java.lang.String)"><code>BeanContext.Builder.typePropertyName(String)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#typePropertyName(java.lang.Class,java.lang.String)">typePropertyName</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>on</code> - The class the type property name applies to.</dd> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <js>"_type"</js>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="useEnumNames()">useEnumNames</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.724">useEnumNames</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#useEnumNames()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Use enum names. |
| |
| <p> |
| When enabled, enums are always serialized by name, not using <code>Object.toString()</code>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer with debug enabled.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .useEnumNames() |
| .build(); |
| |
| <jc>// Enum with overridden toString().</jc> |
| <jc>// Will be serialized as ONE/TWO/THREE even though there's a toString() method.</jc> |
| <jk>public enum</jk> Option { |
| <jsf>ONE</jsf>(1), |
| <jsf>TWO</jsf>(2), |
| <jsf>THREE</jsf>(3); |
| |
| <jk>private int</jk> <jf>value</jf>; |
| |
| Option(<jk>int</jk> <jv>value</jv>) { |
| <jk>this</jk>.<jf>value</jf> = <jv>value</jv>; |
| } |
| |
| <ja>@Override</ja> |
| <jk>public</jk> String toString() { |
| <jk>return</jk> String.<jsm>valueOf</jsm>(<jf>value</jf>); |
| } |
| } |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../BeanContext.Builder.html#useEnumNames()"><code>BeanContext.Builder.useEnumNames()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#useEnumNames()">useEnumNames</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="useJavaBeanIntrospector()">useJavaBeanIntrospector</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.730">useJavaBeanIntrospector</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanContextable.Builder.html#useJavaBeanIntrospector()">BeanContextable.Builder</a></code></span></div> |
| <div class="block">Use Java Introspector. |
| |
| <p> |
| Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters. |
| <br>Most <a href="../annotation/Bean.html" title="annotation in org.apache.juneau.annotation"><code>@Bean</code></a> annotations will be ignored. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that only uses the built-in java bean introspector for finding properties.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .useJavaBeanIntrospector() |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jmf'><a href="../BeanContext.Builder.html#useJavaBeanIntrospector()"><code>BeanContext.Builder.useJavaBeanIntrospector()</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#useJavaBeanIntrospector()">useJavaBeanIntrospector</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="detectRecursions()">detectRecursions</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.736">detectRecursions</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#detectRecursions()">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Automatically detect POJO recursions. |
| |
| <p> |
| When enabled, specifies that recursions should be checked for during traversal. |
| |
| <p> |
| Recursions can occur when traversing models that aren't true trees but rather contain loops. |
| <br>In general, unchecked recursions cause stack-overflow-errors. |
| <br>These show up as <a href="../BeanRecursionException.html" title="class in org.apache.juneau"><code>BeanRecursionException</code></a> with the message <js>"Depth too deep. Stack overflow occurred."</js>. |
| |
| <ul class='notes'> |
| <li class='note'> |
| Checking for recursion can cause a small performance penalty. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that automatically checks for recursions.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .detectRecursions() |
| .build(); |
| |
| <jc>// Create a POJO model with a recursive loop.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>f</jf>; |
| } |
| MyBean <jv>bean</jv> = <jk>new</jk> MyBean(); |
| <jv>bean</jv>.<jf>f</jf> = <jv>bean</jv>; |
| |
| <jc>// Throws a SerializeException and not a StackOverflowError</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>bean</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#detectRecursions()">detectRecursions</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="detectRecursions(boolean)">detectRecursions</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.742">detectRecursions</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#detectRecursions(boolean)">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../BeanTraverseContext.Builder.html#detectRecursions()"><code>BeanTraverseContext.Builder.detectRecursions()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#detectRecursions(boolean)">detectRecursions</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreRecursions()">ignoreRecursions</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.748">ignoreRecursions</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#ignoreRecursions()">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Ignore recursion errors. |
| |
| <p> |
| When enabled, when we encounter the same object when traversing a tree, we set the value to <jk>null</jk>. |
| |
| <p> |
| For example, if a model contains the links A->B->C->A, then the JSON generated will look like |
| the following when this setting is <jk>true</jk>... |
| |
| <p class='bjson'> |
| {A:{B:{C:<jk>null</jk>}}} |
| </p> |
| |
| <ul class='notes'> |
| <li class='note'> |
| Checking for recursion can cause a small performance penalty. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer ignores recursions.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .ignoreRecursions() |
| .build(); |
| |
| <jc>// Create a POJO model with a recursive loop.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> Object <jf>f</jf>; |
| } |
| MyBean <jv>bean</jv> = <jk>new</jk> MyBean(); |
| <jv>bean</jv>.<jf>f</jf> = <jv>bean</jv>; |
| |
| <jc>// Produces "{f:null}"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>bean</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreRecursions()">ignoreRecursions</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ignoreRecursions(boolean)">ignoreRecursions</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.754">ignoreRecursions</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#ignoreRecursions(boolean)">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../BeanTraverseContext.Builder.html#ignoreRecursions()"><code>BeanTraverseContext.Builder.ignoreRecursions()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ignoreRecursions(boolean)">ignoreRecursions</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="initialDepth(int)">initialDepth</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.760">initialDepth</a></span>​(<span class="arguments">int value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#initialDepth(int)">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Initial depth. |
| |
| <p> |
| The initial indentation level at the root. |
| |
| <p> |
| Useful when constructing document fragments that need to be indented at a certain level when whitespace is enabled. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer with whitespace enabled and an initial depth of 2.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .ws() |
| .initialDepth(2) |
| .build(); |
| |
| <jc>// Produces "\t\t{\n\t\t\t'foo':'bar'\n\t\t}\n"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#initialDepth(int)">initialDepth</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <c>0</c>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="maxDepth(int)">maxDepth</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.766">maxDepth</a></span>​(<span class="arguments">int value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../BeanTraverseContext.Builder.html#maxDepth(int)">BeanTraverseContext.Builder</a></code></span></div> |
| <div class="block">Max traversal depth. |
| |
| <p> |
| When enabled, abort traversal if specified depth is reached in the POJO tree. |
| |
| <p> |
| If this depth is exceeded, an exception is thrown. |
| |
| <p> |
| This prevents stack overflows from occurring when trying to traverse models with recursive references. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that throws an exception if the depth reaches greater than 20.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .maxDepth(20) |
| .build(); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../BeanTraverseContext.Builder.html#maxDepth(int)"><code>BeanTraverseContext.Builder.maxDepth(int)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#maxDepth(int)">maxDepth</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this setting. |
| <br>The default is <c>100</c>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="accept(java.lang.String)">accept</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.772">accept</a></span>​(<span class="arguments">java.lang.String value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#accept(java.lang.String)">Serializer.Builder</a></code></span></div> |
| <div class="block">Specifies the accept media types that the serializer can handle. |
| |
| <p> |
| Can contain meta-characters per the <c>media-type</c> specification of <a class="doclink" href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">RFC2616/14.1</a> |
| <p> |
| If empty, then assumes the only media type supported is <c>produces</c>. |
| <p> |
| For example, if this serializer produces <js>"application/json"</js> but should handle media types of |
| <js>"application/json"</js> and <js>"text/json"</js>, then the arguments should be: |
| <p class='bjava'> |
| <jv>builder</jv>.produces(<js>"application/json"</js>); |
| <jv>builder</jv>.accept(<js>"application/json,text/json"</js>); |
| </p> |
| <p> |
| The accept value can also contain q-values.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#accept(java.lang.String)">accept</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addBeanTypes()">addBeanTypes</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.778">addBeanTypes</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#addBeanTypes()">Serializer.Builder</a></code></span></div> |
| <div class="block">Add <js>"_type"</js> properties when needed. |
| |
| <p> |
| When enabled, <js>"_type"</js> properties will be added to beans if their type cannot be inferred |
| through reflection. |
| |
| <p> |
| This is used to recreate the correct objects during parsing if the object types cannot be inferred. |
| <br>For example, when serializing a <c>Map<String,Object></c> field where the bean class cannot be determined from |
| the type of the values. |
| |
| <p> |
| Note the differences between the following settings: |
| <ul class='javatree'> |
| <li class='jf'><a href="../serializer/Serializer.Builder.html#addRootType()"><code>Serializer.Builder.addRootType()</code></a> - Affects whether <js>'_type'</js> is added to root node. |
| <li class='jf'><a href="../serializer/Serializer.Builder.html#addBeanTypes()"><code>Serializer.Builder.addBeanTypes()</code></a> - Affects whether <js>'_type'</js> is added to any nodes. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that adds _type to nodes.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .addBeanTypes() |
| .build(); |
| |
| <jc>// Our map of beans to serialize.</jc> |
| <ja>@Bean</ja>(typeName=<js>"mybean"</js>) |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| JsonMap <jv>myMap</jv> = JsonMap.of(<js>"foo"</js>, <jk>new</jk> MyBean()); |
| |
| <jc>// Will contain: {"foo":{"_type":"mybean","foo":"bar"}}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>myMap</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addBeanTypes()">addBeanTypes</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addBeanTypes(boolean)">addBeanTypes</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.784">addBeanTypes</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#addBeanTypes(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#addBeanTypes()"><code>Serializer.Builder.addBeanTypes()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addBeanTypes(boolean)">addBeanTypes</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addRootType()">addRootType</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.790">addRootType</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#addRootType()">Serializer.Builder</a></code></span></div> |
| <div class="block">Add type attribute to root nodes. |
| |
| <p> |
| When enabled, <js>"_type"</js> properties will be added to top-level beans. |
| |
| <p> |
| When disabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level |
| type information that might normally be included to determine the data type will not be serialized. |
| |
| <p> |
| For example, when serializing a top-level POJO with a <a href="../annotation/Bean.html#typeName()"><code>@Bean(typeName)</code></a> value, a |
| <js>'_type'</js> attribute will only be added when this setting is enabled. |
| |
| <p> |
| Note the differences between the following settings: |
| <ul class='javatree'> |
| <li class='jf'><a href="../serializer/Serializer.Builder.html#addRootType()"><code>Serializer.Builder.addRootType()</code></a> - Affects whether <js>'_type'</js> is added to root node. |
| <li class='jf'><a href="../serializer/Serializer.Builder.html#addBeanTypes()"><code>Serializer.Builder.addBeanTypes()</code></a> - Affects whether <js>'_type'</js> is added to any nodes. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that adds _type to root node.</jc> |
| WriterSerializer <jv>serializer</jv>= JsonSerializer |
| .<jsm>create</jsm>() |
| .addRootType() |
| .build(); |
| |
| <jc>// Our bean to serialize.</jc> |
| <ja>@Bean</ja>(typeName=<js>"mybean"</js>) |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Will contain: {"_type":"mybean","foo":"bar"}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addRootType()">addRootType</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addRootType(boolean)">addRootType</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.796">addRootType</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#addRootType(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#addRootType()"><code>Serializer.Builder.addRootType()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addRootType(boolean)">addRootType</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="keepNullProperties()">keepNullProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.802">keepNullProperties</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#keepNullProperties()">Serializer.Builder</a></code></span></div> |
| <div class="block">Don't trim null bean property values. |
| |
| <p> |
| When enabled, null bean values will be serialized to the output. |
| |
| <ul class='notes'> |
| <li class='note'>Not enabling this setting will cause <c>Map</c>s with <jk>null</jk> values to be lost during parsing. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that serializes null properties.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .keepNullProperties() |
| .build(); |
| |
| <jc>// Our bean to serialize.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <jk>null</jk>; |
| } |
| |
| <jc>// Will contain "{foo:null}".</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#keepNullProperties()">keepNullProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="keepNullProperties(boolean)">keepNullProperties</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.808">keepNullProperties</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#keepNullProperties(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#keepNullProperties()"><code>Serializer.Builder.keepNullProperties()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#keepNullProperties(boolean)">keepNullProperties</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="listener(java.lang.Class)">listener</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.814">listener</a></span>​(<span class="arguments">java.lang.Class<? extends <a href="../serializer/SerializerListener.html" title="class in org.apache.juneau.serializer">SerializerListener</a>> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#listener(java.lang.Class)">Serializer.Builder</a></code></span></div> |
| <div class="block">Serializer listener. |
| |
| <p> |
| Class used to listen for errors and warnings that occur during serialization. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Define our serializer listener.</jc> |
| <jc>// Simply captures all errors.</jc> |
| <jk>public class</jk> MySerializerListener <jk>extends</jk> SerializerListener { |
| |
| <jc>// A simple property to store our events.</jc> |
| <jk>public</jk> List<String> <jf>events</jf> = <jk>new</jk> LinkedList<>(); |
| |
| <ja>@Override</ja> |
| <jk>public</jk> <T> <jk>void</jk> onError(SerializerSession <jv>session</jv>, Throwable <jv>throwable</jv>, String <jv>msg</jv>) { |
| <jf>events</jf>.add(<jv>session</jv>.getLastLocation() + <js>","</js> + <jv>msg</jv> + <js>","</js> + <jv>throwable</jv>); |
| } |
| } |
| |
| <jc>// Create a serializer using our listener.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .listener(MySerializerListener.<jk>class</jk>) |
| .build(); |
| |
| <jc>// Create a session object.</jc> |
| <jc>// Needed because listeners are created per-session.</jc> |
| <jk>try</jk> (WriterSerializerSession <jv>session</jv> = <jv>serializer</jv>.createSession()) { |
| |
| <jc>// Serialize a bean.</jc> |
| String <jv>json</jv> = <jv>session</jv>.serialize(<jk>new</jk> MyBean()); |
| |
| <jc>// Get the listener.</jc> |
| MySerializerListener <jv>listener</jv> = <jv>session</jv>.getListener(MySerializerListener.<jk>class</jk>); |
| |
| <jc>// Dump the results to the console.</jc> |
| Json5.<jsf>DEFAULT</jsf>.println(<jv>listener</jv>.<jf>events</jf>); |
| } |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#listener(java.lang.Class)">listener</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="produces(java.lang.String)">produces</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.820">produces</a></span>​(<span class="arguments">java.lang.String value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#produces(java.lang.String)">Serializer.Builder</a></code></span></div> |
| <div class="block">Specifies the media type that this serializer produces.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#produces(java.lang.String)">produces</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortCollections()">sortCollections</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.826">sortCollections</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#sortCollections()">Serializer.Builder</a></code></span></div> |
| <div class="block">Sort arrays and collections alphabetically. |
| |
| <p> |
| When enabled, copies and sorts the contents of arrays and collections before serializing them. |
| |
| <p> |
| Note that this introduces a performance penalty since it requires copying the existing collection. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that sorts arrays and collections before serialization.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .sortCollections() |
| .build(); |
| |
| <jc>// An unsorted array</jc> |
| String[] <jv>myArray</jv> = {<js>"foo"</js>,<js>"bar"</js>,<js>"baz"</js>}; |
| |
| <jc>// Produces ["bar","baz","foo"]</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>myArray</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortCollections()">sortCollections</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortCollections(boolean)">sortCollections</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.832">sortCollections</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#sortCollections(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#sortCollections()"><code>Serializer.Builder.sortCollections()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortCollections(boolean)">sortCollections</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortMaps()">sortMaps</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.838">sortMaps</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#sortMaps()">Serializer.Builder</a></code></span></div> |
| <div class="block">Sort maps alphabetically. |
| |
| <p> |
| When enabled, copies and sorts the contents of maps by their keys before serializing them. |
| |
| <p> |
| Note that this introduces a performance penalty. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that sorts maps before serialization.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .sortMaps() |
| .build(); |
| |
| <jc>// An unsorted map.</jc> |
| JsonMap <jv>myMap</jv> = JsonMap.<jsm>of</jsm>(<js>"foo"</js>,1,<js>"bar"</js>,2,<js>"baz"</js>,3); |
| |
| <jc>// Produces {"bar":2,"baz":3,"foo":1}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jv>myMap</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortMaps()">sortMaps</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sortMaps(boolean)">sortMaps</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.844">sortMaps</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#sortMaps(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#sortMaps()"><code>Serializer.Builder.sortMaps()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sortMaps(boolean)">sortMaps</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimEmptyCollections()">trimEmptyCollections</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.850">trimEmptyCollections</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimEmptyCollections()">Serializer.Builder</a></code></span></div> |
| <div class="block">Trim empty lists and arrays. |
| |
| <p> |
| When enabled, empty lists and arrays will not be serialized. |
| |
| <p> |
| Note that enabling this setting has the following effects on parsing: |
| <ul class='spaced-list'> |
| <li> |
| Map entries with empty list values will be lost. |
| <li> |
| Bean properties with empty list values will not be set. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that skips empty arrays and collections.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .trimEmptyCollections() |
| .build(); |
| |
| <jc>// A bean with a field with an empty array.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String[] <jf>foo</jf> = {}; |
| } |
| |
| <jc>// Produces {}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimEmptyCollections()">trimEmptyCollections</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimEmptyCollections(boolean)">trimEmptyCollections</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.856">trimEmptyCollections</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimEmptyCollections(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimEmptyCollections()"><code>Serializer.Builder.trimEmptyCollections()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimEmptyCollections(boolean)">trimEmptyCollections</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimEmptyMaps()">trimEmptyMaps</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.862">trimEmptyMaps</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimEmptyMaps()">Serializer.Builder</a></code></span></div> |
| <div class="block">Trim empty maps. |
| |
| <p> |
| When enabled, empty map values will not be serialized to the output. |
| |
| <p> |
| Note that enabling this setting has the following effects on parsing: |
| <ul class='spaced-list'> |
| <li> |
| Bean properties with empty map values will not be set. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that skips empty maps.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .trimEmptyMaps() |
| .build(); |
| |
| <jc>// A bean with a field with an empty map.</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> JsonMap <jf>foo</jf> = JsonMap.<jsm>of</jsm>(); |
| } |
| |
| <jc>// Produces {}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimEmptyMaps()">trimEmptyMaps</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimEmptyMaps(boolean)">trimEmptyMaps</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.868">trimEmptyMaps</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimEmptyMaps(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimEmptyMaps()"><code>Serializer.Builder.trimEmptyMaps()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimEmptyMaps(boolean)">trimEmptyMaps</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimStrings()">trimStrings</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.874">trimStrings</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimStrings()">Serializer.Builder</a></code></span></div> |
| <div class="block">Trim strings. |
| |
| <p> |
| When enabled, string values will be trimmed of whitespace using <code>String.trim()</code> before being serialized. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that trims strings before serialization.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .trimStrings() |
| .build(); |
| |
| <jc>// A map with space-padded keys/values</jc> |
| JsonMap <jv>myMap</jv> = JsonMap.<jsm>of</jsm>(<js>" foo "</js>, <js>" bar "</js>); |
| |
| <jc>// Produces "{foo:'bar'}"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.toString(<jv>myMap</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimStrings()">trimStrings</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="trimStrings(boolean)">trimStrings</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.880">trimStrings</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#trimStrings(boolean)">Serializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/Serializer.Builder.html#trimStrings()"><code>Serializer.Builder.trimStrings()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#trimStrings(boolean)">trimStrings</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="uriContext(org.apache.juneau.UriContext)">uriContext</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.886">uriContext</a></span>​(<span class="arguments"><a href="../UriContext.html" title="class in org.apache.juneau">UriContext</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#uriContext(org.apache.juneau.UriContext)">Serializer.Builder</a></code></span></div> |
| <div class="block">URI context bean. |
| |
| <p> |
| Bean used for resolution of URIs to absolute or root-relative form. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Our URI contextual information.</jc> |
| String <jv>authority</jv> = <js>"http://localhost:10000"</js>; |
| String <jv>contextRoot</jv> = <js>"/myContext"</js>; |
| String <jv>servletPath</jv> = <js>"/myServlet"</js>; |
| String <jv>pathInfo</jv> = <js>"/foo"</js>; |
| |
| <jc>// Create a UriContext object.</jc> |
| UriContext <jv>uriContext</jv> = <jk>new</jk> UriContext(<jv>authority</jv>, <jv>contextRoot</jv>, <jv>servletPath</jv>, <jv>pathInfo</jv>); |
| |
| <jc>// Associate it with our serializer.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .uriContext(<jv>uriContext</jv>) |
| .uriRelativity(<jsf>RESOURCE</jsf>) <jc>// Assume relative paths are relative to servlet.</jc> |
| .uriResolution(<jsf>ABSOLUTE</jsf>) <jc>// Serialize URLs as absolute paths.</jc> |
| .build(); |
| |
| <jc>// A relative URL</jc> |
| URL <jv>myUrl</jv> = <jk>new</jk> URL(<js>"bar"</js>); |
| |
| <jc>// Produces "http://localhost:10000/myContext/myServlet/foo/bar"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.toString(<jv>myUrl</jv>); |
| </p> |
| |
| <ul class='seealso'> |
| <li class='link'><a class="doclink" href="../../../../overview-summary.html#juneau-marshall.jm.MarshallingUris">URIs</a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#uriContext(org.apache.juneau.UriContext)">uriContext</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="uriRelativity(org.apache.juneau.UriRelativity)">uriRelativity</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.892">uriRelativity</a></span>​(<span class="arguments"><a href="../UriRelativity.html" title="enum in org.apache.juneau">UriRelativity</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#uriRelativity(org.apache.juneau.UriRelativity)">Serializer.Builder</a></code></span></div> |
| <div class="block">URI relativity. |
| |
| <p> |
| Defines what relative URIs are relative to when serializing any of the following: |
| <ul> |
| <li><code>URI</code> |
| <li><code>URL</code> |
| <li>Properties and classes annotated with <a href="../annotation/Uri.html" title="annotation in org.apache.juneau.annotation"><code>@Uri</code></a> |
| </ul> |
| |
| <p> |
| See <a href="../serializer/Serializer.Builder.html#uriContext(org.apache.juneau.UriContext)"><code>Serializer.Builder.uriContext(UriContext)</code></a> for examples. |
| |
| <ul class='values javatree'> |
| <li class='jf'><a href="../UriRelativity.html#RESOURCE"><code>UriRelativity.RESOURCE</code></a> |
| - Relative URIs should be considered relative to the servlet URI. |
| <li class='jf'><a href="../UriRelativity.html#PATH_INFO"><code>UriRelativity.PATH_INFO</code></a> |
| - Relative URIs should be considered relative to the request URI. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='link'><a class="doclink" href="../../../../overview-summary.html#juneau-marshall.jm.MarshallingUris">URIs</a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#uriRelativity(org.apache.juneau.UriRelativity)">uriRelativity</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <a href="../UriRelativity.html#RESOURCE"><code>UriRelativity.RESOURCE</code></a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="uriResolution(org.apache.juneau.UriResolution)">uriResolution</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.898">uriResolution</a></span>​(<span class="arguments"><a href="../UriResolution.html" title="enum in org.apache.juneau">UriResolution</a> value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/Serializer.Builder.html#uriResolution(org.apache.juneau.UriResolution)">Serializer.Builder</a></code></span></div> |
| <div class="block">URI resolution. |
| |
| <p> |
| Defines the resolution level for URIs when serializing any of the following: |
| <ul> |
| <li><code>URI</code> |
| <li><code>URL</code> |
| <li>Properties and classes annotated with <a href="../annotation/Uri.html" title="annotation in org.apache.juneau.annotation"><code>@Uri</code></a> |
| </ul> |
| |
| <p> |
| See <a href="../serializer/Serializer.Builder.html#uriContext(org.apache.juneau.UriContext)"><code>Serializer.Builder.uriContext(UriContext)</code></a> for examples. |
| |
| <ul class='values javatree'> |
| <li class='jf'><a href="../UriResolution.html#ABSOLUTE"><code>UriResolution.ABSOLUTE</code></a> |
| - Resolve to an absolute URL (e.g. <js>"http://host:port/context-root/servlet-path/path-info"</js>). |
| <li class='jf'><a href="../UriResolution.html#ROOT_RELATIVE"><code>UriResolution.ROOT_RELATIVE</code></a> |
| - Resolve to a root-relative URL (e.g. <js>"/context-root/servlet-path/path-info"</js>). |
| <li class='jf'><a href="../UriResolution.html#NONE"><code>UriResolution.NONE</code></a> |
| - Don't do any URL resolution. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='link'><a class="doclink" href="../../../../overview-summary.html#juneau-marshall.jm.MarshallingUris">URIs</a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#uriResolution(org.apache.juneau.UriResolution)">uriResolution</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <a href="../UriResolution.html#NONE"><code>UriResolution.NONE</code></a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="fileCharset(java.nio.charset.Charset)">fileCharset</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.904">fileCharset</a></span>​(<span class="arguments">java.nio.charset.Charset value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#fileCharset(java.nio.charset.Charset)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">File charset. |
| |
| <p> |
| The character set to use for writing <c>Files</c> to the file system. |
| |
| <p> |
| Used when passing in files to <a href="../serializer/Serializer.html#serialize(java.lang.Object,java.lang.Object)"><code>Serializer.serialize(Object, Object)</code></a>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that writes UTF-8 files.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .fileCharset(Charset.<jsm>forName</jsm>(<js>"UTF-8"</js>)) |
| .build(); |
| |
| <jc>// Use it to read a UTF-8 encoded file.</jc> |
| <jv>serializer</jv>.serialize(<jk>new</jk> File(<js>"MyBean.txt"</js>), <jv>myBean</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#fileCharset(java.nio.charset.Charset)">fileCharset</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is the system JVM setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="maxIndent(int)">maxIndent</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.910">maxIndent</a></span>​(<span class="arguments">int value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#maxIndent(int)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Maximum indentation. |
| |
| <p> |
| Specifies the maximum indentation level in the serialized document. |
| |
| <ul class='notes'> |
| <li class='note'>This setting does not apply to the RDF serializers. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that indents a maximum of 20 tabs.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .ws() <jc>// Enable whitespace</jc> |
| .maxIndent(20) |
| .build(); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#maxIndent(int)">maxIndent</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <c>100</c>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="quoteChar(char)">quoteChar</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.916">quoteChar</a></span>​(<span class="arguments">char value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#quoteChar(char)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Quote character. |
| |
| <p> |
| Specifies the character to use for quoting attributes and values. |
| |
| <ul class='notes'> |
| <li class='note'>This setting does not apply to the RDF serializers. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that uses single quotes.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .quoteChar(<js>'\''</js>) |
| .build(); |
| |
| <jc>// A bean with a single property</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Produces {'foo':'bar'}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.toString(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#quoteChar(char)">quoteChar</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <js>'"'</js>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="quoteCharOverride(char)">quoteCharOverride</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.922">quoteCharOverride</a></span>​(<span class="arguments">char value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#quoteCharOverride(char)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Quote character override. |
| |
| <p> |
| Similar to <a href="../serializer/WriterSerializer.Builder.html#quoteChar(char)"><code>WriterSerializer.Builder.quoteChar(char)</code></a> but takes precedence over that setting. |
| |
| <p> |
| Allows you to override the quote character even if it's set by a subclass such as <a href="Json5Serializer.html" title="class in org.apache.juneau.json"><code>Json5Serializer</code></a>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#quoteCharOverride(char)">quoteCharOverride</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is <jk>null</jk>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="sq()">sq</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.928">sq</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#sq()">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Quote character. |
| |
| <p> |
| Specifies to use single quotes for quoting attributes and values. |
| |
| <ul class='notes'> |
| <li class='note'>This setting does not apply to the RDF serializers. |
| </ul> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that uses single quotes.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .sq() |
| .build(); |
| |
| <jc>// A bean with a single property</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Produces {'foo':'bar'}</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.toString(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#sq()">sq</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="streamCharset(java.nio.charset.Charset)">streamCharset</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.934">streamCharset</a></span>​(<span class="arguments">java.nio.charset.Charset value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#streamCharset(java.nio.charset.Charset)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Output stream charset. |
| |
| <p> |
| The character set to use when writing to <c>OutputStreams</c>. |
| |
| <p> |
| Used when passing in output streams and byte arrays to <a href="../serializer/Serializer.html#serialize(java.lang.Object,java.lang.Object)"><code>Serializer.serialize(Object, Object)</code></a>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer that writes UTF-8 files.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .streamCharset(Charset.<jsm>forName</jsm>(<js>"UTF-8"</js>)) |
| .build(); |
| |
| <jc>// Use it to write to a UTF-8 encoded output stream.</jc> |
| <jv>serializer</jv>.serializer(<jk>new</jk> FileOutputStreamStream(<js>"MyBean.txt"</js>), <jv>myBean</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#streamCharset(java.nio.charset.Charset)">streamCharset</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The new value for this property. |
| <br>The default is the system JVM setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="useWhitespace()">useWhitespace</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.940">useWhitespace</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#useWhitespace()">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Use whitespace. |
| |
| <p> |
| When enabled, whitespace is added to the output to improve readability. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer with whitespace enabled.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .useWhitespace() |
| .build(); |
| |
| <jc>// A bean with a single property</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Produces "\{\n\t"foo": "bar"\n\}\n"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#useWhitespace()">useWhitespace</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="useWhitespace(boolean)">useWhitespace</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.946">useWhitespace</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#useWhitespace(boolean)">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="../serializer/WriterSerializer.Builder.html#useWhitespace()"><code>WriterSerializer.Builder.useWhitespace()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#useWhitespace(boolean)">useWhitespace</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="ws()">ws</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.952">ws</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../serializer/WriterSerializer.Builder.html#ws()">WriterSerializer.Builder</a></code></span></div> |
| <div class="block">Use whitespace. |
| |
| <p> |
| When enabled, whitespace is added to the output to improve readability. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a serializer with whitespace enabled.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .ws() |
| .build(); |
| |
| <jc>// A bean with a single property</jc> |
| <jk>public class</jk> MyBean { |
| <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>; |
| } |
| |
| <jc>// Produces "\{\n\t"foo": "bar"\n\}\n"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(<jk>new</jk> MyBean()); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#ws()">ws</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addBeanTypesJson()">addBeanTypesJson</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.958">addBeanTypesJson</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#addBeanTypesJson()">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Add <js>"_type"</js> properties when needed. |
| |
| <p> |
| If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred |
| through reflection. |
| |
| <p> |
| When present, this value overrides the <a href="../serializer/Serializer.Builder.html#addBeanTypes()"><code>Serializer.Builder.addBeanTypes()</code></a> setting and is |
| provided to customize the behavior of specific serializers in a <a href="../serializer/SerializerSet.html" title="class in org.apache.juneau.serializer"><code>SerializerSet</code></a>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addBeanTypesJson()">addBeanTypesJson</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="addBeanTypesJson(boolean)">addBeanTypesJson</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.964">addBeanTypesJson</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#addBeanTypesJson(boolean)">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#addBeanTypesJson()"><code>JsonSerializer.Builder.addBeanTypesJson()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#addBeanTypesJson(boolean)">addBeanTypesJson</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="escapeSolidus()">escapeSolidus</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.970">escapeSolidus</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#escapeSolidus()">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Prefix solidus <js>'/'</js> characters with escapes. |
| |
| <p> |
| If enabled, solidus (e.g. slash) characters should be escaped. |
| |
| <p> |
| The JSON specification allows for either format. |
| <br>However, if you're embedding JSON in an HTML script tag, this setting prevents confusion when trying to serialize |
| <xt><\/script></xt>. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a JSON serializer that escapes solidus characters.</jc> |
| WriterSerializer <jv>serializer</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .simple() |
| .escapeSolidus() |
| .build(); |
| |
| <jc>// Produces: "{foo:'<\/bar>'"</jc> |
| String <jv>json</jv> = <jv>serializer</jv>.serialize(JsonMap.<jsm>of</jsm>(<js>"foo"</js>, <js>"</bar>"</js>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#escapeSolidus()">escapeSolidus</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="escapeSolidus(boolean)">escapeSolidus</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.976">escapeSolidus</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#escapeSolidus(boolean)">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#escapeSolidus()"><code>JsonSerializer.Builder.escapeSolidus()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#escapeSolidus(boolean)">escapeSolidus</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="simpleAttrs()">simpleAttrs</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.982">simpleAttrs</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#simpleAttrs()">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Simple JSON attributes mode. |
| |
| <p> |
| If enabled, JSON attribute names will only be quoted when necessary. |
| <br>Otherwise, they are always quoted. |
| |
| <p> |
| Attributes do not need to be quoted when they conform to the following: |
| <ol class='spaced-list'> |
| <li>They start with an ASCII character or <js>'_'</js>. |
| <li>They contain only ASCII characters or numbers or <js>'_'</js>. |
| <li>They are not one of the following reserved words: |
| <p class='bcode'> |
| arguments, break, case, catch, class, const, continue, debugger, default, |
| delete, do, else, enum, eval, export, extends, false, finally, for, function, |
| if, implements, import, in, instanceof, interface, let, new, null, package, |
| private, protected, public, return, static, super, switch, this, throw, |
| true, try, typeof, var, void, while, with, undefined, yield |
| </p> |
| </ol> |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Create a JSON serializer in normal mode.</jc> |
| WriterSerializer <jv>serializer1</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .build(); |
| |
| <jc>// Create a JSON serializer in simple mode.</jc> |
| WriterSerializer <jv>serializer2</jv> = JsonSerializer |
| .<jsm>create</jsm>() |
| .simpleAttrs() |
| .build(); |
| |
| JsonMap <jv>myMap</jv> = JsonMap.<jsm>of</jsm>( |
| <js>"foo"</js>, <js>"x1"</js>, |
| <js>"_bar"</js>, <js>"x2"</js>, |
| <js>" baz "</js>, <js>"x3"</js>, |
| <js>"123"</js>, <js>"x4"</js>, |
| <js>"return"</js>, <js>"x5"</js>, |
| <js>""</js>, <js>"x6"</js> |
| ); |
| |
| <jc>// Produces:</jc> |
| <jc>// {</jc> |
| <jc>// "foo": "x1"</jc> |
| <jc>// "_bar": "x2"</jc> |
| <jc>// " baz ": "x3"</jc> |
| <jc>// "123": "x4"</jc> |
| <jc>// "return": "x5"</jc> |
| <jc>// "": "x6"</jc> |
| <jc>// }</jc> |
| String <jv>json1</jv> = <jv>serializer1</jv>.serialize(<jv>myMap</jv>); |
| |
| <jc>// Produces:</jc> |
| <jc>// {</jc> |
| <jc>// foo: "x1"</jc> |
| <jc>// _bar: "x2"</jc> |
| <jc>// " baz ": "x3"</jc> |
| <jc>// "123": "x4"</jc> |
| <jc>// "return": "x5"</jc> |
| <jc>// "": "x6"</jc> |
| <jc>// }</jc> |
| String <jv>json2</jv> = <jv>serializer2</jv>.serialize(<jv>myMap</jv>); |
| </p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#simpleAttrs()">simpleAttrs</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="simpleAttrs(boolean)">simpleAttrs</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.988">simpleAttrs</a></span>​(<span class="arguments">boolean value)</span></div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#simpleAttrs(boolean)">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Same as <a href="JsonSerializer.Builder.html#simpleAttrs()"><code>JsonSerializer.Builder.simpleAttrs()</code></a> but allows you to explicitly specify the value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#simpleAttrs(boolean)">simpleAttrs</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - The value for this setting.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| <li class="blockList"> |
| <section class="detail"> |
| <h3><a id="json5()">json5</a></h3> |
| <div class="memberSignature"><span class="modifiers">public</span> <span class="returnType"><a href="JsonSchemaSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSchemaSerializer.Builder</a></span> <span class="memberName"><a href="../../../../src-html/org/apache/juneau/json/JsonSchemaSerializer.Builder.html#line.994">json5</a></span>()</div> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="JsonSerializer.Builder.html#json5()">JsonSerializer.Builder</a></code></span></div> |
| <div class="block">Simple JSON mode and single quote. |
| |
| <p> |
| Shortcut for calling <c>simple().sq()</c>. |
| |
| <ul class='seealso'> |
| <li class='jm'><a href="../serializer/WriterSerializer.Builder.html#quoteChar(char)"><code>WriterSerializer.Builder.quoteChar(char)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JsonSerializer.Builder.html#json5()">json5</a></code> in class <code><a href="JsonSerializer.Builder.html" title="class in org.apache.juneau.json">JsonSerializer.Builder</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2016–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </div> |
| </div> |
| </body> |
| </html> |