001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau;
014
015import static org.apache.juneau.BeanContext.*;
016import static org.apache.juneau.internal.StringUtils.*;
017
018import java.beans.*;
019import java.io.*;
020import java.lang.annotation.*;
021import java.lang.reflect.*;
022import java.util.*;
023
024import org.apache.juneau.annotation.*;
025import org.apache.juneau.http.*;
026import org.apache.juneau.internal.*;
027import org.apache.juneau.marshall.*;
028import org.apache.juneau.parser.*;
029import org.apache.juneau.reflect.*;
030import org.apache.juneau.svl.*;
031import org.apache.juneau.transform.*;
032
033/**
034 * Builder class for building instances of serializers, parsers, and bean contexts.
035 *
036 * <p>
037 * All serializers and parsers extend from this class.
038 *
039 * <p>
040 * Provides a base set of common config property setters that allow you to build up serializers and parsers.
041 *
042 * <p class='bcode w800'>
043 *    WriterSerializer s = JsonSerializer
044 *       .<jsm>create</jsm>()
045 *       .set(<jsf>JSON_simpleMode</jsf>, <jk>true</jk>)
046 *       .set(<jsf>SERIALIZER_useWhitespace</jsf>, <jk>true</jk>)
047 *       .set(<jsf>SERIALIZER_quoteChar</jsf>, <js>"'"</js>)
048 *       .build();
049 * </p>
050 *
051 * <p>
052 * Additional convenience methods are provided for setting properties using reduced syntax.
053 *
054 * <p class='bcode w800'>
055 *    WriterSerializer s = JsonSerializer
056 *       .<jsm>create</jsm>()  <jc>// Create a JsonSerializerBuilder</jc>
057 *       .simple()  <jc>// Simple mode</jc>
058 *       .ws()  <jc>// Use whitespace</jc>
059 *       .sq()  <jc>// Use single quotes </jc>
060 *       .build();  <jc>// Create a JsonSerializer</jc>
061 * </p>
062 *
063 * <ul class='seealso'>
064 *    <li class='link'>{@doc GlossaryConfigurableProperties}
065 * </ul>
066 */
067public class BeanContextBuilder extends ContextBuilder {
068
069   /**
070    * Constructor.
071    *
072    * All default settings.
073    */
074   public BeanContextBuilder() {
075      super();
076   }
077
078   /**
079    * Constructor.
080    *
081    * @param ps The initial configuration settings for this builder.
082    */
083   public BeanContextBuilder(PropertyStore ps) {
084      super(ps);
085   }
086
087   @Override /* ContextBuilder */
088   public BeanContext build() {
089      return build(BeanContext.class);
090   }
091
092   //-----------------------------------------------------------------------------------------------------------------
093   // Properties
094   //-----------------------------------------------------------------------------------------------------------------
095
096   /**
097    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Dynamically applied POJO annotations.
098    *
099    * <p>
100    * Defines annotations to apply to specific classes and methods.
101    *
102    * <p>
103    * Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods.
104    * Useful in cases where you want to use the functionality of the annotation on beans and bean properties but
105    * do not have access to the code to do so.
106    *
107    * <p>
108    * As a rule, any Juneau annotation with an <c>on()</c> method can be used with this property.
109    *
110    * <p>
111    * The following example shows the equivalent methods for applying the {@link Bean @Bean} annotation:
112    * <p class='bcode w800'>
113    *    <jc>// Class with explicit annotation.</jc>
114    *    <ja>@Bean</ja>(bpi=<js>"street,city,state"</js>)
115    *    <jk>public class</jk> A {...}
116    *
117    *    <jc>// Class with annotation applied via @BeanConfig</jc>
118    *    <jk>public class</jk> B {...}
119    *
120    *    <jc>// Java REST method with @BeanConfig annotation.</jc>
121    *    <ja>@RestMethod</ja>(...)
122    *    <ja>@BeanConfig</ja>(
123    *       annotations={
124    *          <ja>@Bean</ja>(on=<js>"B"</js>, bpi=<js>"street,city,state"</js>)
125    *       }
126    *    )
127    *    <jk>public void</jk> doFoo() {...}
128    * </p>
129    *
130    * <p>
131    * In general, the underlying framework uses this method when it finds dynamically applied annotations on
132    * config annotations.  However, concrete implementations of annotations are also provided that can be passed
133    * directly into builder classes like so:
134    * <p class='bcode w800'>
135    *    <jc>// Create a concrete @Bean annotation.</jc>
136    *    BeanAnnotation a = <jk>new</jk> BeanAnnotation(<js>"B"</js>).bpi(<js>"street,city,state"</js>);
137    *
138    *    <jc>// Apply it to a serializer.</jc>
139    *    WriterSerializer ws = JsonSerializer.<jsm>create</jsm>().annotations(a).build();
140    *
141    *    <jc>// Serialize a bean with the dynamically applied annotation.</jc>
142    *    String json = ws.serialize(<jk>new</jk> B());
143    * </p>
144    *
145    * <p>
146    * The following is the list of concrete annotations provided that can be constructed and passed into the builder
147    * class:
148    * <ul class='javatree'>
149    *    <li class='ja'>{@link org.apache.juneau.annotation.BeanAnnotation}
150    *    <li class='ja'>{@link org.apache.juneau.annotation.BeancAnnotation}
151    *    <li class='ja'>{@link org.apache.juneau.annotation.BeanIgnoreAnnotation}
152    *    <li class='ja'>{@link org.apache.juneau.annotation.BeanpAnnotation}
153    *    <li class='ja'>{@link org.apache.juneau.annotation.ExampleAnnotation}
154    *    <li class='ja'>{@link org.apache.juneau.annotation.NamePropertyAnnotation}
155    *    <li class='ja'>{@link org.apache.juneau.annotation.ParentPropertyAnnotation}
156    *    <li class='ja'>{@link org.apache.juneau.annotation.SwapAnnotation}
157    *    <li class='ja'>{@link org.apache.juneau.annotation.UriAnnotation}
158    *    <li class='ja'>{@link org.apache.juneau.csv.annotation.CsvAnnotation}
159    *    <li class='ja'>{@link org.apache.juneau.html.annotation.HtmlAnnotation}
160    *    <li class='ja'>{@link org.apache.juneau.jso.annotation.JsoAnnotation}
161    *    <li class='ja'>{@link org.apache.juneau.json.annotation.JsonAnnotation}
162    *    <li class='ja'>{@link org.apache.juneau.jsonschema.annotation.SchemaAnnotation}
163    *    <li class='ja'>{@link org.apache.juneau.msgpack.annotation.MsgPackAnnotation}
164    *    <li class='ja'>{@link org.apache.juneau.oapi.annotation.OpenApiAnnotation}
165    *    <li class='ja'>{@link org.apache.juneau.plaintext.annotation.PlainTextAnnotation}
166    *    <li class='ja'>{@link org.apache.juneau.soap.annotation.SoapXmlAnnotation}
167    *    <li class='ja'>{@link org.apache.juneau.uon.annotation.UonAnnotation}
168    *    <li class='ja'>{@link org.apache.juneau.urlencoding.annotation.UrlEncodingAnnotation}
169    *    <li class='ja'>{@link org.apache.juneau.xml.annotation.XmlAnnotation}
170    * </ul>
171    *
172    * <p>
173    * The syntax for the <l>on()</l> pattern match parameter depends on whether it applies to a class, method, field, or constructor.
174    * The valid pattern matches are:
175    * <ul class='spaced-list'>
176    *  <li>Classes:
177    *       <ul>
178    *          <li>Fully qualified:
179    *             <ul>
180    *                <li><js>"com.foo.MyClass"</js>
181    *             </ul>
182    *          <li>Fully qualified inner class:
183    *             <ul>
184    *                <li><js>"com.foo.MyClass$Inner1$Inner2"</js>
185    *             </ul>
186    *          <li>Simple:
187    *             <ul>
188    *                <li><js>"MyClass"</js>
189    *             </ul>
190    *          <li>Simple inner:
191    *             <ul>
192    *                <li><js>"MyClass$Inner1$Inner2"</js>
193    *                <li><js>"Inner1$Inner2"</js>
194    *                <li><js>"Inner2"</js>
195    *             </ul>
196    *       </ul>
197    *    <li>Methods:
198    *       <ul>
199    *          <li>Fully qualified with args:
200    *             <ul>
201    *                <li><js>"com.foo.MyClass.myMethod(String,int)"</js>
202    *                <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js>
203    *                <li><js>"com.foo.MyClass.myMethod()"</js>
204    *             </ul>
205    *          <li>Fully qualified:
206    *             <ul>
207    *                <li><js>"com.foo.MyClass.myMethod"</js>
208    *             </ul>
209    *          <li>Simple with args:
210    *             <ul>
211    *                <li><js>"MyClass.myMethod(String,int)"</js>
212    *                <li><js>"MyClass.myMethod(java.lang.String,int)"</js>
213    *                <li><js>"MyClass.myMethod()"</js>
214    *             </ul>
215    *          <li>Simple:
216    *             <ul>
217    *                <li><js>"MyClass.myMethod"</js>
218    *             </ul>
219    *          <li>Simple inner class:
220    *             <ul>
221    *                <li><js>"MyClass$Inner1$Inner2.myMethod"</js>
222    *                <li><js>"Inner1$Inner2.myMethod"</js>
223    *                <li><js>"Inner2.myMethod"</js>
224    *             </ul>
225    *       </ul>
226    *    <li>Fields:
227    *       <ul>
228    *          <li>Fully qualified:
229    *             <ul>
230    *                <li><js>"com.foo.MyClass.myField"</js>
231    *             </ul>
232    *          <li>Simple:
233    *             <ul>
234    *                <li><js>"MyClass.myField"</js>
235    *             </ul>
236    *          <li>Simple inner class:
237    *             <ul>
238    *                <li><js>"MyClass$Inner1$Inner2.myField"</js>
239    *                <li><js>"Inner1$Inner2.myField"</js>
240    *                <li><js>"Inner2.myField"</js>
241    *             </ul>
242    *       </ul>
243    *    <li>Constructors:
244    *       <ul>
245    *          <li>Fully qualified with args:
246    *             <ul>
247    *                <li><js>"com.foo.MyClass(String,int)"</js>
248    *                <li><js>"com.foo.MyClass(java.lang.String,int)"</js>
249    *                <li><js>"com.foo.MyClass()"</js>
250    *             </ul>
251    *          <li>Simple with args:
252    *             <ul>
253    *                <li><js>"MyClass(String,int)"</js>
254    *                <li><js>"MyClass(java.lang.String,int)"</js>
255    *                <li><js>"MyClass()"</js>
256    *             </ul>
257    *          <li>Simple inner class:
258    *             <ul>
259    *                <li><js>"MyClass$Inner1$Inner2()"</js>
260    *                <li><js>"Inner1$Inner2()"</js>
261    *                <li><js>"Inner2()"</js>
262    *             </ul>
263    *       </ul>
264    *    <li>A comma-delimited list of anything on this list.
265    * </ul>
266    *
267    * <ul class='seealso'>
268    *    <li class='jf'>{@link BeanContext#BEAN_annotations}
269    * </ul>
270    *
271    * @param values
272    *    The values to add to this property.
273    * @return This object (for method chaining).
274    */
275   @FluentSetter
276   public BeanContextBuilder annotations(Annotation...values) {
277      return prependTo(BEAN_annotations, values);
278   }
279
280   /**
281    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Minimum bean class visibility.
282    *
283    * <p>
284    * Classes are not considered beans unless they meet the minimum visibility requirements.
285    * For example, if the visibility is <jsf>PUBLIC</jsf> and the bean class is <jk>protected</jk>, then the class
286    * will not be interpreted as a bean class and be serialized as a string.
287    * Use this setting to reduce the visibility requirement.
288    *
289    * <h5 class='section'>Example:</h5>
290    * <p class='bcode w800'>
291    *    <jc>// A bean with a protected class and one field.</jc>
292    *    <jk>protected class</jk> MyBean {
293    *       <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>;
294    *    }
295    *
296    *    <jc>// Create a serializer that's capable of serializing the class.</jc>
297    *    WriterSerializer s = JsonSerializer
298    *       .<jsm>create</jsm>()
299    *       .beanClassVisibility(<jsf>PROTECTED</jsf>)
300    *       .build();
301    *
302    *    <jc>// Same, but use property.</jc>
303    *    WriterSerializer s = JsonSerializer
304    *       .<jsm>create</jsm>()
305    *       .set(<jsf>BEAN_beanClassVisibility</jsf>, <js>"PROTECTED"</js>)
306    *       .build();
307    *
308    *    <jc>// Produces:  {"foo","bar"}</jc>
309    *    String json = w.serialize(<jk>new</jk> MyBean());
310    * </p>
311    *
312    * <ul class='notes'>
313    *    <li>The {@link Bean @Bean} annotation can be used on a non-public bean class to override this setting.
314    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a public bean class to ignore it as a bean.
315    * </ul>
316    *
317    * <ul class='seealso'>
318    *    <li class='jf'>{@link BeanContext#BEAN_beanClassVisibility}
319    * </ul>
320    *
321    * @param value
322    *    The new value for this property.
323    *    <br>The default is {@link Visibility#PUBLIC}.
324    * @return This object (for method chaining).
325    */
326   @FluentSetter
327   public BeanContextBuilder beanClassVisibility(Visibility value) {
328      return set(BEAN_beanClassVisibility, value);
329   }
330
331   /**
332    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Minimum bean constructor visibility.
333    *
334    * <p>
335    * Only look for constructors with the specified minimum visibility.
336    *
337    * <p>
338    * This setting affects the logic for finding no-arg constructors for bean.  Normally, only <jk>public</jk> no-arg
339    * constructors are used.  Use this setting if you want to reduce the visibility requirement.
340    *
341    * <h5 class='section'>Example:</h5>
342    * <p class='bcode w800'>
343    *    <jc>// A bean with a protected constructor and one field.</jc>
344    *    <jk>public class</jk> MyBean {
345    *       <jk>public</jk> String <jf>foo</jf>;
346    *
347    *       <jk>protected</jk> MyBean() {}
348    *    }
349    *
350    *    <jc>// Create a parser capable of calling the protected constructor.</jc>
351    *    ReaderParser p = ReaderParser
352    *       .<jsm>create</jsm>()
353    *       .beanConstructorVisibility(<jsf>PROTECTED</jsf>)
354    *       .build();
355    *
356    *    <jc>// Same, but use property.</jc>
357    *    ReaderParser p = JsonParser
358    *       .<jsm>create</jsm>()
359    *       .set(<jsf>BEAN_beanConstructorVisibility</jsf>, <js>"PROTECTED"</js>)
360    *       .build();
361    *
362    *    <jc>// Use it.</jc>
363    *    MyBean c = r.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>);
364    * </p>
365    *
366    * <ul class='notes'>
367    *    <li>The {@link Beanc @Beanc} annotation can also be used to expose a non-public constructor.
368    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a public bean constructor to ignore it.
369    * </ul>
370    *
371    * <ul class='seealso'>
372    *    <li class='jf'>{@link BeanContext#BEAN_beanConstructorVisibility}
373    * </ul>
374    *
375    * @param value
376    *    The new value for this property.
377    *    <br>The default is {@link Visibility#PUBLIC}.
378    * @return This object (for method chaining).
379    */
380   @FluentSetter
381   public BeanContextBuilder beanConstructorVisibility(Visibility value) {
382      return set(BEAN_beanConstructorVisibility, value);
383   }
384
385   /**
386    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
387    *
388    * <div class='warn'>
389    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
390    * </div>
391    *
392    * @param values
393    *    The values to add to this property.
394    * @return This object (for method chaining).
395    */
396   @Deprecated
397   @FluentSetter
398   public BeanContextBuilder beanDictionary(Object...values) {
399      return prependTo(BEAN_beanDictionary, values);
400   }
401
402   /**
403    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
404    *
405    * <div class='warn'>
406    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
407    * </div>
408    */
409   @SuppressWarnings("javadoc")
410   @Deprecated
411   @FluentSetter
412   public BeanContextBuilder beanDictionary(Class<?>...values) {
413      return prependTo(BEAN_beanDictionary, values);
414   }
415
416   /**
417    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
418    *
419    * <div class='warn'>
420    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
421    * </div>
422    */
423   @SuppressWarnings("javadoc")
424   @Deprecated
425   @FluentSetter
426   public BeanContextBuilder beanDictionaryReplace(Class<?>...values) {
427      return set(BEAN_beanDictionary, values);
428   }
429
430   /**
431    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
432    *
433    * <div class='warn'>
434    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
435    * </div>
436    */
437   @SuppressWarnings("javadoc")
438   @Deprecated
439   @FluentSetter
440   public BeanContextBuilder beanDictionaryReplace(Object...values) {
441      return set(BEAN_beanDictionary, values);
442   }
443
444   /**
445    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
446    *
447    * <div class='warn'>
448    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
449    * </div>
450    */
451   @SuppressWarnings("javadoc")
452   @Deprecated
453   @FluentSetter
454   public BeanContextBuilder beanDictionaryRemove(Class<?>...values) {
455      return removeFrom(BEAN_beanDictionary, values);
456   }
457
458   /**
459    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
460    *
461    * <div class='warn'>
462    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
463    * </div>
464    */
465   @SuppressWarnings("javadoc")
466   @Deprecated
467   @FluentSetter
468   public BeanContextBuilder beanDictionaryRemove(Object...values) {
469      return removeFrom(BEAN_beanDictionary, values);
470   }
471
472   /**
473    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Minimum bean field visibility.
474    *
475    * <p>
476    * Only look for bean fields with the specified minimum visibility.
477    *
478    * <p>
479    * This affects which fields on a bean class are considered bean properties.  Normally only <jk>public</jk> fields are considered.
480    * Use this setting if you want to reduce the visibility requirement.
481    *
482    * <h5 class='section'>Example:</h5>
483    * <p class='bcode w800'>
484    *    <jc>// A bean with a protected field.</jc>
485    *    <jk>public class</jk> MyBean {
486    *       <jk>protected</jk> String <jf>foo</jf> = <js>"bar"</js>;
487    *    }
488    *
489    *    <jc>// Create a serializer that recognizes the protected field.</jc>
490    *    WriterSerializer s = JsonSerializer
491    *       .<jsm>create</jsm>()
492    *       .beanFieldVisibility(<jsf>PROTECTED</jsf>)
493    *       .build();
494    *
495    *    <jc>// Same, but use property.</jc>
496    *    WriterSerializer s = JsonSerializer
497    *       .<jsm>create</jsm>()
498    *       .set(<jsf>BEAN_beanFieldVisibility</jsf>, <js>"PROTECTED"</js>)
499    *       .build();
500    *
501    *    <jc>// Produces:  {"foo":"bar"}</jc>
502    *    String json = s.serialize(<jk>new</jk> MyBean());
503    * </p>
504    *
505    * <p>
506    * Bean fields can be ignored as properties entirely by setting the value to {@link Visibility#NONE}
507    *
508    * <p class='bcode w800'>
509    *    <jc>// Disable using fields as properties entirely.</jc>
510    *    WriterSerializer s = JsonSerializer
511    *       .<jsm>create</jsm>()
512    *       .beanFieldVisibility(<jsf>NONE</jsf>)
513    *       .build();
514    * </p>
515    *
516    * <ul class='notes'>
517    *    <li>The {@link Beanp @Beanp} annotation can also be used to expose a non-public field.
518    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a public bean field to ignore it as a bean property.
519    * </ul>
520    *
521    * <ul class='seealso'>
522    *    <li class='jf'>{@link BeanContext#BEAN_beanFieldVisibility}
523    * </ul>
524    *
525    * @param value
526    *    The new value for this property.
527    *    <br>The default is {@link Visibility#PUBLIC}.
528    * @return This object (for method chaining).
529    */
530   @FluentSetter
531   public BeanContextBuilder beanFieldVisibility(Visibility value) {
532      return set(BEAN_beanFieldVisibility, value);
533   }
534
535   /**
536    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean filters.
537    *
538    * <div class='warn'>
539    *    <b>Deprecated</b> - Use {@link BeanConfig#interfaces()} and other methods.
540    * </div>
541    */
542   @SuppressWarnings("javadoc")
543   @FluentSetter
544   @Deprecated
545   public BeanContextBuilder beanFilters(Object...values) {
546      return prependTo(BEAN_beanFilters, values);
547   }
548
549   /**
550    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean filters.
551    *
552    * <div class='warn'>
553    *    <b>Deprecated</b> - Use {@link BeanConfig#interfaces()} and other methods.
554    * </div>
555    */
556   @SuppressWarnings("javadoc")
557   @FluentSetter
558   @Deprecated
559   public BeanContextBuilder beanFiltersReplace(Object...values) {
560      return set(BEAN_beanFilters, values);
561   }
562
563   /**
564    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean filters.
565    *
566    * <div class='warn'>
567    *    <b>Deprecated</b> - Use {@link BeanConfig#interfaces()} and other methods.
568    * </div>
569    */
570   @SuppressWarnings("javadoc")
571   @FluentSetter
572   @Deprecated
573   public BeanContextBuilder beanFiltersRemove(Object...values) {
574      return removeFrom(BEAN_beanFilters, values);
575   }
576
577   /**
578    * Bean interceptor.
579    *
580    * <p>
581    * Bean interceptors can be used to intercept calls to getters and setters and alter their values in transit.
582    *
583    * <h5 class='section'>Example:</h5>
584    * <p class='bcode w800'>
585    *    <jc>// Interceptor that strips out sensitive information.</jc>
586    *    <jk>public class</jk> AddressInterceptor <jk>extends</jk> BeanInterceptor&lt;Address&gt; {
587    *
588    *       <jk>public</jk> Object readProperty(Address bean, String name, Object value) {
589    *          <jk>if</jk> (<js>"taxInfo"</js>.equals(name))
590    *             <jk>return</jk> <js>"redacted"</js>;
591    *          <jk>return</jk> value;
592    *       }
593    *
594    *       <jk>public</jk> Object writeProperty(Address bean, String name, Object value) {
595    *          <jk>if</jk> (<js>"taxInfo"</js>.equals(name) &amp;&amp; <js>"redacted"</js>.equals(value))
596    *             <jk>return</jk> TaxInfoUtils.<jsm>lookup</jsm>(bean.getStreet(), bean.getCity(), bean.getState());
597    *          <jk>return</jk> value;
598    *       }
599    *    }
600    *
601    *    <jc>// Our bean class.</jc>
602    *    <jk>public class</jk> Address {
603    *       <jk>public</jk> String getTaxInfo() {...}
604    *       <jk>public void</jk> setTaxInfo(String s) {...}
605    *    }
606    *
607    *    <jc>// Register filter on serializer or parser.</jc>
608    *    WriterSerializer s = JsonSerializer
609    *       .<jsm>create</jsm>()
610    *       .beanInterceptor(Address.<jk>class</jk>, AddressInterceptor.<jk>class</jk>)
611    *       .build();
612    *
613    *    <jc>// Produces:  {"taxInfo":"redacted"}</jc>
614    *    String json = s.serialize(<jk>new</jk> Address());
615    * </p>
616    *
617    * <ul class='seealso'>
618    *    <li class='jc'>{@link BeanInterceptor}
619    *    <li class='ja'>{@link Bean#interceptor() Bean(interceptor)}
620    * </ul>
621    *
622    * @param on The bean that the filter applies to.
623    * @param value
624    *    The new value for this property.
625    * @return This object (for method chaining).
626    */
627   @FluentSetter
628   public BeanContextBuilder beanInterceptor(Class<?> on, Class<? extends BeanInterceptor<?>> value) {
629      return prependTo(BEAN_annotations, new BeanAnnotation(on).interceptor(value));
630   }
631
632   /**
633    * <i><l>BeanContext</l> configuration property:&emsp;</i>  BeanMap.put() returns old property value.
634    *
635    * <div class='warn'>
636    *    <b>Deprecated</b> - Use {@link #beanMapPutReturnsOldValue()}
637    * </div>
638    */
639   @SuppressWarnings("javadoc")
640   @FluentSetter
641   @Deprecated
642   public BeanContextBuilder beanMapPutReturnsOldValue(boolean value) {
643      return set(BEAN_beanMapPutReturnsOldValue, value);
644   }
645
646   /**
647    * <i><l>BeanContext</l> configuration property:&emsp;</i>  BeanMap.put() returns old property value.
648    *
649    * <p>
650    * When enabled, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property
651    * values.  Otherwise, it returns <jk>null</jk>.
652    *
653    * <p>
654    * Disabled by default because it introduces a slight performance penalty during serialization.
655    *
656    * <h5 class='section'>Example:</h5>
657    * <p class='bcode w800'>
658    *    <jc>// Create a serializer that creates BeanMaps with normal put() behavior.</jc>
659    *    WriterSerializer s = JsonSerializer
660    *       .<jsm>create</jsm>()
661    *       .beanMapPutReturnsOldValue()
662    *       .build();
663    *
664    *    <jc>// Same, but use property.</jc>
665    *    WriterSerializer s = JsonSerializer
666    *       .<jsm>create</jsm>()
667    *       .set(<jsf>BEAN_beanMapPutReturnsOldValue</jsf>, <jk>true</jk>)
668    *       .build();
669    *
670    *    BeanMap&lt;MyBean&gt; bm = s.createSession().toBeanMap(<jk>new</jk> MyBean());
671    *    bm.put(<js>"foo"</js>, <js>"bar"</js>);
672    *    Object oldValue = bm.put(<js>"foo"</js>, <js>"baz"</js>);  <jc>// oldValue == "bar"</jc>
673    * </p>
674    *
675    * <ul class='seealso'>
676    *    <li class='jf'>{@link BeanContext#BEAN_beanMapPutReturnsOldValue}
677    * </ul>
678    *
679    * @return This object (for method chaining).
680    */
681   @FluentSetter
682   public BeanContextBuilder beanMapPutReturnsOldValue() {
683      return set(BEAN_beanMapPutReturnsOldValue, true);
684   }
685
686   /**
687    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Minimum bean method visibility.
688    *
689    * <p>
690    * Only look for bean methods with the specified minimum visibility.
691    *
692    * <p>
693    * This affects which methods are detected as getters and setters on a bean class. Normally only <jk>public</jk> getters and setters are considered.
694    * Use this setting if you want to reduce the visibility requirement.
695    *
696    * <h5 class='section'>Example:</h5>
697    * <p class='bcode w800'>
698    *    <jc>// A bean with a protected getter.</jc>
699    *    <jk>public class</jk> MyBean {
700    *       <jk>public</jk> String getFoo() { <jk>return</jk> <js>"foo"</js>; }
701    *       <jk>protected</jk> String getBar() { <jk>return</jk> <js>"bar"</js>; }
702    *    }
703    *
704    *    <jc>// Create a serializer that looks for protected getters and setters.</jc>
705    *    WriterSerializer s = JsonSerializer
706    *       .<jsm>create</jsm>()
707    *       .beanMethodVisibility(<jsf>PROTECTED</jsf>)
708    *       .build();
709    *
710    *    <jc>// Same, but use property.</jc>
711    *    WriterSerializer s = JsonSerializer
712    *       .<jsm>create</jsm>()
713    *       .set(<jsf>BEAN_beanMethodVisibility</jsf>, <js>"PROTECTED"</js>)
714    *       .build();
715    *
716    *    <jc>// Produces:  {"foo":"foo","bar":"bar"}</jc>
717    *    String json = s.serialize(<jk>new</jk> MyBean());
718    * </p>
719    *
720    * <ul class='notes'>
721    *    <li>The {@link Beanp @Beanp} annotation can also be used to expose a non-public method.
722    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a public bean getter/setter to ignore it as a bean property.
723    * </ul>
724    *
725    * <ul class='seealso'>
726    *    <li class='jf'>{@link BeanContext#BEAN_beanMethodVisibility}
727    * </ul>
728    *
729    * @param value
730    *    The new value for this property.
731    *    <br>The default is {@link Visibility#PUBLIC}
732    * @return This object (for method chaining).
733    */
734   @FluentSetter
735   public BeanContextBuilder beanMethodVisibility(Visibility value) {
736      return set(BEAN_beanMethodVisibility, value);
737   }
738
739   /**
740    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require no-arg constructors.
741    *
742    * <div class='warn'>
743    *    <b>Deprecated</b> - Use {@link #beansRequireDefaultConstructor()}
744    * </div>
745    */
746   @SuppressWarnings("javadoc")
747   @Deprecated
748   @FluentSetter
749   public BeanContextBuilder beansRequireDefaultConstructor(boolean value) {
750      return set(BEAN_beansRequireDefaultConstructor, value);
751   }
752
753   /**
754    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require no-arg constructors.
755    *
756    * <p>
757    * When enabled, a Java class must implement a default no-arg constructor to be considered a bean.
758    * Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
759    *
760    * <h5 class='section'>Example:</h5>
761    * <p class='bcode w800'>
762    *    <jc>// A bean without a no-arg constructor.</jc>
763    *    <jk>public class</jk> MyBean {
764    *
765    *       <jc>// A property method.</jc>
766    *       <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>;
767    *
768    *       <jc>// A no-arg constructor</jc>
769    *       <jk>public</jk> MyBean(String foo) {
770    *          <jk>this</jk>.<jf>foo</jf> = foo;
771    *       }
772    *
773    *       <ja>@Override</ja>
774    *       <jk>public</jk> String toString() {
775    *          <jk>return</jk> <js>"bar"</js>;
776    *       }
777    *    }
778    *
779    *    <jc>// Create a serializer that ignores beans without default constructors.</jc>
780    *    WriterSerializer s = JsonSerializer
781    *       .<jsm>create</jsm>()
782    *       .beansRequireDefaultConstructor()
783    *       .build();
784    *
785    *    <jc>// Same, but use property.</jc>
786    *    WriterSerializer s = JsonSerializer
787    *       .<jsm>create</jsm>()
788    *       .set(<jsf>BEAN_beansRequireDefaultConstructor</jsf>, <jk>true</jk>)
789    *       .build();
790    *
791    *    <jc>// Produces:  "bar"</jc>
792    *    String json = s.serialize(<jk>new</jk> MyBean());
793    * </p>
794    *
795    * <ul class='notes'>
796    *    <li>The {@link Bean @Bean} annotation can be used on a bean class to override this setting.
797    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a class to ignore it as a bean.
798    * </ul>
799    *
800    * <ul class='seealso'>
801    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireDefaultConstructor}
802    * </ul>
803    *
804    * @return This object (for method chaining).
805    */
806   @FluentSetter
807   public BeanContextBuilder beansRequireDefaultConstructor() {
808      return set(BEAN_beansRequireDefaultConstructor, true);
809   }
810
811   /**
812    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require Serializable interface.
813    *
814    * <div class='warn'>
815    *    <b>Deprecated</b> - Use {@link #beansRequireSerializable()}
816    * </div>
817    */
818   @SuppressWarnings("javadoc")
819   @Deprecated
820   @FluentSetter
821   public BeanContextBuilder beansRequireSerializable(boolean value) {
822      return set(BEAN_beansRequireSerializable, value);
823   }
824
825   /**
826    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require Serializable interface.
827    *
828    * <p>
829    * When enabled, a Java class must implement the {@link Serializable} interface to be considered a bean.
830    * Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
831    *
832    * <h5 class='section'>Example:</h5>
833    * <p class='bcode w800'>
834    *    <jc>// A bean without a Serializable interface.</jc>
835    *    <jk>public class</jk> MyBean {
836    *
837    *       <jc>// A property method.</jc>
838    *       <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>;
839    *
840    *       <ja>@Override</ja>
841    *       <jk>public</jk> String toString() {
842    *          <jk>return</jk> <js>"bar"</js>;
843    *       }
844    *    }
845    *
846    *    <jc>// Create a serializer that ignores beans not implementing Serializable.</jc>
847    *    WriterSerializer s = JsonSerializer
848    *       .<jsm>create</jsm>()
849    *       .beansRequireSerializable()
850    *       .build();
851    *
852    *    <jc>// Same, but use property.</jc>
853    *    WriterSerializer s = JsonSerializer
854    *       .<jsm>create</jsm>()
855    *       .set(<jsf>BEAN_beansRequireSerializable</jsf>, <jk>true</jk>)
856    *       .build();
857    *
858    *    <jc>// Produces:  "bar"</jc>
859    *    String json = s.serialize(<jk>new</jk> MyBean());
860    * </p>
861    *
862    * <ul class='notes'>
863    *    <li>The {@link Bean @Bean} annotation can be used on a bean class to override this setting.
864    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on a class to ignore it as a bean.
865    * </ul>
866    *
867    * <ul class='seealso'>
868    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSerializable}
869    * </ul>
870    *
871    * @return This object (for method chaining).
872    */
873   @FluentSetter
874   public BeanContextBuilder beansRequireSerializable() {
875      return set(BEAN_beansRequireSerializable, true);
876   }
877
878   /**
879    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require setters for getters.
880    *
881    * <div class='warn'>
882    *    <b>Deprecated</b> - Use {@link #beansRequireSettersForGetters()}
883    * </div>
884    */
885   @SuppressWarnings("javadoc")
886   @Deprecated
887   @FluentSetter
888   public BeanContextBuilder beansRequireSettersForGetters(boolean value) {
889      return set(BEAN_beansRequireSettersForGetters, value);
890   }
891
892   /**
893    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require setters for getters.
894    *
895    * <p>
896    * When enabled, ignore read-only properties (properties with getters but not setters).
897    *
898    * <h5 class='section'>Example:</h5>
899    * <p class='bcode w800'>
900    *    <jc>// A bean without a Serializable interface.</jc>
901    *    <jk>public class</jk> MyBean {
902    *
903    *       <jc>// A read/write property.</jc>
904    *       <jk>public</jk> String getFoo() { <jk>return</jk> <js>"foo"</js>; }
905    *       <jk>public void</jk> setFoo(String foo) { ... }
906    *
907    *       <jc>// A read-only property.</jc>
908    *       <jk>public</jk> String getBar() { <jk>return</jk> <js>"bar"</js>; }
909    *    }
910    *
911    *    <jc>// Create a serializer that ignores bean properties without setters.</jc>
912    *    WriterSerializer s = JsonSerializer
913    *       .<jsm>create</jsm>()
914    *       .beansRequireSettersForGetters()
915    *       .build();
916    *
917    *    <jc>// Same, but use property.</jc>
918    *    WriterSerializer s = JsonSerializer
919    *       .<jsm>create</jsm>()
920    *       .set(<jsf>BEAN_beansRequireSettersForGetters</jsf>, <jk>true</jk>)
921    *       .build();
922    *
923    *    <jc>// Produces:  {"foo":"foo"}</jc>
924    *    String json = s.serialize(<jk>new</jk> MyBean());
925    * </p>
926    *
927    * <ul class='notes'>
928    *    <li>The {@link Beanp @Beanp} annotation can be used on the getter to override this setting.
929    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on getters to ignore them as bean properties.
930    * </ul>
931    *
932    * <ul class='seealso'>
933    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSettersForGetters}
934    * </ul>
935    *
936    * @return This object (for method chaining).
937    */
938   @FluentSetter
939   public BeanContextBuilder beansRequireSettersForGetters() {
940      return set(BEAN_beansRequireSettersForGetters, true);
941   }
942
943   /**
944    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require at least one property.
945    *
946    * <div class='warn'>
947    *    <b>Deprecated</b> - Use {@link #beansDontRequireSomeProperties()}
948    * </div>
949    */
950   @SuppressWarnings("javadoc")
951   @Deprecated
952   @FluentSetter
953   public BeanContextBuilder beansRequireSomeProperties(boolean value) {
954      return set(BEAN_beansRequireSomeProperties, value);
955   }
956
957   /**
958    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Beans require at least one property.
959    *
960    * <p>
961    * When enabled, then a Java class must contain at least 1 property to be considered a bean.
962    * Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
963    *
964    * <p>
965    * The {@link Bean @Bean} annotation can be used on a class to override this setting when <jk>true</jk>.
966    *
967    * <h5 class='section'>Example:</h5>
968    * <p class='bcode w800'>
969    *    <jc>// A bean with no properties.</jc>
970    *    <jk>public class</jk> MyBean {
971    *    }
972    *
973    *    <jc>// Create a serializer that serializes beans even if they have zero properties.</jc>
974    *    WriterSerializer s = JsonSerializer
975    *       .<jsm>create</jsm>()
976    *       .beansDontRequireSomeProperties()
977    *       .build();
978    *
979    *    <jc>// Same, but use property.</jc>
980    *    WriterSerializer s = JsonSerializer
981    *       .<jsm>create</jsm>()
982    *       .set(<jsf>BEAN_beansRequireSomeProperties</jsf>, <jk>false</jk>)
983    *       .build();
984    *
985    *    <jc>// Produces:  {}</jc>
986    *    String json = s.serialize(<jk>new</jk> MyBean());
987    * </p>
988    *
989    * <ul class='notes'>
990    *    <li>The {@link Bean @Bean} annotation can be used on the class to force it to be recognized as a bean class
991    *       even if it has no properties.
992    * </ul>
993    *
994    * <ul class='seealso'>
995    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSomeProperties}
996    * </ul>
997    *
998    * @return This object (for method chaining).
999    */
1000   @FluentSetter
1001   public BeanContextBuilder beansDontRequireSomeProperties() {
1002      return set(BEAN_beansRequireSomeProperties, false);
1003   }
1004
1005   /**
1006    * Bean property includes.
1007    *
1008    * <p>
1009    * Specifies the set and order of names of properties associated with the bean class.
1010    *
1011    * <p>
1012    * For example, <c>bpi(MyBean.<jk>class</jk>, <js>"foo,bar"</js>)</c> means only serialize the <c>foo</c> and
1013    * <c>bar</c> properties on the specified bean.  Likewise, parsing will ignore any bean properties not specified
1014    * and either throw an exception or silently ignore them depending on whether {@link #ignoreUnknownBeanProperties()}
1015    * has been called.
1016    *
1017    * <p>
1018    * This value is entirely optional if you simply want to expose all the getters and public fields on
1019    * a class as bean properties.  However, it's useful if you want certain getters to be ignored or you want the properties to be
1020    * serialized in a particular order.  Note that on IBM JREs, the property order is the same as the order in the source code,
1021    * whereas on Oracle JREs, the order is entirely random.
1022    *
1023    * <p>
1024    * Setting applies to specified class and all subclasses.
1025    *
1026    * <h5 class='section'>Example:</h5>
1027    * <p class='bcode w800'>
1028    *    <jc>// A bean with 3 properties.</jc>
1029    *    <jk>public class</jk> MyBean {
1030    *       <jk>public</jk> String
1031    *          <jf>foo</jf> = <js>"foo"</js>,
1032    *          <jf>bar</jf> = <js>"bar"</js>,
1033    *          <jf>baz</jf> = <js>"baz"</js>;
1034    *    }
1035    *
1036    *    <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc>
1037    *    WriterSerializer s = JsonSerializer
1038    *       .<jsm>create</jsm>()
1039    *       .bpi(MyBean.<jk>class</jk>, <js>"foo,bar"</js>)
1040    *       .build();
1041    *
1042    *    <jc>// Produces:  {"foo":"foo","bar":"bar"}</jc>
1043    *    String json = s.serialize(<jk>new</jk> MyBean());
1044    * </p>
1045    *
1046    * <p>
1047    * This method is functionally equivalent to the following code:
1048    * <p class='bcode w800'>
1049    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClass.getName()).bpi(properties));
1050    * </p>
1051    *
1052    * <ul class='seealso'>
1053    *    <li class='jm'>{@link Bean#bpi()} - On an annotation on the bean class itself.
1054    *    <li class='jm'>{@link BeanConfig#bpi()} - On a bean config annotation (see {@link #annotations(Annotation...)}).
1055    * </ul>
1056    *
1057    * @param beanClass The bean class.
1058    * @param properties Comma-delimited list of property names.
1059    * @return This object (for method chaining).
1060    */
1061   @FluentSetter
1062   public BeanContextBuilder bpi(Class<?> beanClass, String properties) {
1063      return prependTo(BEAN_annotations, new BeanAnnotation(beanClass.getName()).bpi(properties));
1064   }
1065
1066   /**
1067    * Bean property includes.
1068    *
1069    * <p>
1070    * Specifies the set and order of names of properties associated with bean classes.
1071    *
1072    * <p>
1073    * For example, <c>bpi(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"foo,bar"</js>))</c> means only serialize the <c>foo</c> and
1074    * <c>bar</c> properties on the specified bean.  Likewise, parsing will ignore any bean properties not specified
1075    * and either throw an exception or silently ignore them depending on whether {@link #ignoreUnknownBeanProperties()}
1076    * has been called.
1077    *
1078    * <p>
1079    * This value is entirely optional if you simply want to expose all the getters and public fields on
1080    * a class as bean properties.  However, it's useful if you want certain getters to be ignored or you want the properties to be
1081    * serialized in a particular order.  Note that on IBM JREs, the property order is the same as the order in the source code,
1082    * whereas on Oracle JREs, the order is entirely random.
1083    *
1084    * <p>
1085    * Setting applies to specified class and all subclasses.
1086    *
1087    * <h5 class='section'>Example:</h5>
1088    * <p class='bcode w800'>
1089    *    <jc>// A bean with 3 properties.</jc>
1090    *    <jk>public class</jk> MyBean {
1091    *       <jk>public</jk> String
1092    *          <jf>foo</jf> = <js>"foo"</js>,
1093    *          <jf>bar</jf> = <js>"bar"</js>,
1094    *          <jf>baz</jf> = <js>"baz"</js>;
1095    *    }
1096    *
1097    *    <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc>
1098    *    WriterSerializer s = JsonSerializer
1099    *       .<jsm>create</jsm>()
1100    *       .bpi(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"foo,bar"</js>))
1101    *       .build();
1102    *
1103    *    <jc>// Produces:  {"foo":"foo","bar":"bar"}</jc>
1104    *    String json = s.serialize(<jk>new</jk> MyBean());
1105    * </p>
1106    *
1107    * <p>
1108    * This method is functionally equivalent to the following code for each entry:
1109    * <p class='bcode w800'>
1110    *    builder.annotations(<jk>new</jk> BeanAnnotation(key).bpi(value.toString()));
1111    * </p>
1112    *
1113    * <ul class='seealso'>
1114    *    <li class='jm'>{@link Bean#bpi()} - On an annotation on the bean class itself.
1115    *    <li class='jm'>{@link BeanConfig#bpi()} - On a bean config annotation (see {@link #annotations(Annotation...)}).
1116    * </ul>
1117    *
1118    * @param values
1119    *    The values to add to this builder.
1120    *    <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
1121    *    <br>Values are comma-delimited lists of property names.  Non-String objects are first converted to Strings.
1122    * @return This object (for method chaining).
1123    */
1124   @FluentSetter
1125   public BeanContextBuilder bpi(Map<String,Object> values) {
1126      for (Map.Entry<String,Object> e : values.entrySet())
1127         prependTo(BEAN_annotations, new BeanAnnotation(e.getKey()).bpi(stringify(e.getValue())));
1128      return this;
1129   }
1130
1131   /**
1132    * Bean property includes.
1133    *
1134    * <p>
1135    * Specifies the set and order of names of properties associated with the bean class.
1136    *
1137    * <p>
1138    * For example, <c>bpi(<js>"MyBean"</js>, <js>"foo,bar"</js>)</c> means only serialize the <c>foo</c> and
1139    * <c>bar</c> properties on the specified bean.  Likewise, parsing will ignore any bean properties not specified
1140    * and either throw an exception or silently ignore them depending on whether {@link #ignoreUnknownBeanProperties()}
1141    * has been called.
1142    *
1143    * <p>
1144    * This value is entirely optional if you simply want to expose all the getters and public fields on
1145    * a class as bean properties.  However, it's useful if you want certain getters to be ignored or you want the properties to be
1146    * serialized in a particular order.  Note that on IBM JREs, the property order is the same as the order in the source code,
1147    * whereas on Oracle JREs, the order is entirely random.
1148    *
1149    * <p>
1150    * Setting applies to specified class and all subclasses.
1151    *
1152    * <h5 class='section'>Example:</h5>
1153    * <p class='bcode w800'>
1154    *    <jc>// A bean with 3 properties.</jc>
1155    *    <jk>public class</jk> MyBean {
1156    *       <jk>public</jk> String
1157    *          <jf>foo</jf> = <js>"foo"</js>,
1158    *          <jf>bar</jf> = <js>"bar"</js>,
1159    *          <jf>baz</jf> = <js>"baz"</js>;
1160    *    }
1161    *
1162    *    <jc>// Create a serializer that includes only the 'foo' and 'bar' properties on the MyBean class.</jc>
1163    *    WriterSerializer s = JsonSerializer
1164    *       .<jsm>create</jsm>()
1165    *       .bpi(<js>"MyBean"</js>, <js>"foo,bar"</js>)
1166    *       .build();
1167    *
1168    *    <jc>// Produces:  {"foo":"foo","bar":"bar"}</jc>
1169    *    String json = s.serialize(<jk>new</jk> MyBean());
1170    * </p>
1171    *
1172    * <p>
1173    * This method is functionally equivalent to the following code:
1174    * <p class='bcode w800'>
1175    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClassName).bpi(properties));
1176    * </p>
1177    *
1178    * <ul class='seealso'>
1179    *    <li class='jm'>{@link Bean#bpi()} - On an annotation on the bean class itself.
1180    *    <li class='jm'>{@link BeanConfig#bpi()} - On a bean config annotation (see {@link #annotations(Annotation...)}).
1181    * </ul>
1182    *
1183    * @param beanClassName
1184    *    The bean class name.
1185    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
1186    * @param properties Comma-delimited list of property names.
1187    * @return This object (for method chaining).
1188    */
1189   @FluentSetter
1190   public BeanContextBuilder bpi(String beanClassName, String properties) {
1191      return prependTo(BEAN_annotations, new BeanAnnotation(beanClassName).bpi(properties));
1192   }
1193
1194   /**
1195    * Bean property excludes.
1196    *
1197    * <p>
1198    * Specifies to exclude the specified list of properties for the specified bean class.
1199    *
1200    * <p>
1201    * Same as {@link #bpi(Class, String)} except you specify a list of bean property names that you want to exclude from
1202    * serialization.
1203    *
1204    * <p>
1205    * Setting applies to specified class and all subclasses.
1206    *
1207    * <h5 class='section'>Example:</h5>
1208    * <p class='bcode w800'>
1209    *    <jc>// A bean with 3 properties.</jc>
1210    *    <jk>public class</jk> MyBean {
1211    *       <jk>public</jk> String
1212    *          <jf>foo</jf> = <js>"foo"</js>,
1213    *          <jf>bar</jf> = <js>"bar"</js>,
1214    *          <jf>baz</jf> = <js>"baz"</js>;
1215    *    }
1216    *
1217    *    <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc>
1218    *    WriterSerializer s = JsonSerializer
1219    *       .<jsm>create</jsm>()
1220    *       .bpx(MyBean.<jk>class</jk>, <js>"bar,baz"</js>)
1221    *       .build();
1222    *
1223    *    <jc>// Produces:  {"foo":"foo"}</jc>
1224    *    String json = s.serialize(<jk>new</jk> MyBean());
1225    * </p>
1226    *
1227    * <p>
1228    * This method is functionally equivalent to the following code:
1229    * <p class='bcode w800'>
1230    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClass.getName()).bpx(properties));
1231    * </p>
1232    *
1233    * <ul class='seealso'>
1234    *    <li class='jm'>{@link BeanConfig#bpx()}
1235    *    <li class='jm'>{@link Bean#bpx()}
1236    * </ul>
1237    *
1238    * @param beanClass The bean class.
1239    * @param properties Comma-delimited list of property names.
1240    * @return This object (for method chaining).
1241    */
1242   @FluentSetter
1243   public BeanContextBuilder bpx(Class<?> beanClass, String properties) {
1244      return prependTo(BEAN_annotations, new BeanAnnotation(beanClass.getName()).bpx(properties));
1245   }
1246
1247   /**
1248    * Bean property excludes.
1249    *
1250    * <p>
1251    * Specifies to exclude the specified list of properties for the specified bean classes.
1252    *
1253    * <p>
1254    * Same as {@link #bpi(Map)} except you specify a list of bean property names that you want to exclude from
1255    * serialization.
1256    *
1257    * <p>
1258    * Setting applies to specified class and all subclasses.
1259    *
1260    * <h5 class='section'>Example:</h5>
1261    * <p class='bcode w800'>
1262    *    <jc>// A bean with 3 properties.</jc>
1263    *    <jk>public class</jk> MyBean {
1264    *       <jk>public</jk> String
1265    *          <jf>foo</jf> = <js>"foo"</js>,
1266    *          <jf>bar</jf> = <js>"bar"</js>,
1267    *          <jf>baz</jf> = <js>"baz"</js>;
1268    *    }
1269    *
1270    *    <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc>
1271    *    WriterSerializer s = JsonSerializer
1272    *       .<jsm>create</jsm>()
1273    *       .bpx(AMap.of(<js>"MyBean"</js>, <js>"bar,baz"</js>))
1274    *       .build();
1275    *
1276    *    <jc>// Produces:  {"foo":"foo"}</jc>
1277    *    String json = s.serialize(<jk>new</jk> MyBean());
1278    * </p>
1279    *
1280    * <p>
1281    * This method is functionally equivalent to the following code for each entry:
1282    * <p class='bcode w800'>
1283    *    builder.annotations(<jk>new</jk> BeanAnnotation(key).bpx(value.toString()));
1284    * </p>
1285    *
1286    * <ul class='seealso'>
1287    *    <li class='jm'>{@link BeanConfig#bpx()}
1288    *    <li class='jm'>{@link Bean#bpx()}
1289    * </ul>
1290    *
1291    * @param values
1292    *    The values to add to this builder.
1293    *    <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
1294    *    <br>Values are comma-delimited lists of property names.  Non-String objects are first converted to Strings.
1295    * @return This object (for method chaining).
1296    */
1297   @FluentSetter
1298   public BeanContextBuilder bpx(Map<String,Object> values) {
1299      for (Map.Entry<String,Object> e : values.entrySet())
1300         prependTo(BEAN_annotations, new BeanAnnotation(e.getKey()).bpx(stringify(e.getValue())));
1301      return this;
1302   }
1303
1304   /**
1305    * Bean property excludes.
1306    *
1307    * <p>
1308    * Specifies to exclude the specified list of properties for the specified bean class.
1309    *
1310    * <p>
1311    * Same as {@link #bpx(String, String)} except you specify a list of bean property names that you want to exclude from
1312    * serialization.
1313    *
1314    * <p>
1315    * Setting applies to specified class and all subclasses.
1316    *
1317    * <h5 class='section'>Example:</h5>
1318    * <p class='bcode w800'>
1319    *    <jc>// A bean with 3 properties.</jc>
1320    *    <jk>public class</jk> MyBean {
1321    *       <jk>public</jk> String
1322    *          <jf>foo</jf> = <js>"foo"</js>,
1323    *          <jf>bar</jf> = <js>"bar"</js>,
1324    *          <jf>baz</jf> = <js>"baz"</js>;
1325    *    }
1326    *
1327    *    <jc>// Create a serializer that excludes the "bar" and "baz" properties on the MyBean class.</jc>
1328    *    WriterSerializer s = JsonSerializer
1329    *       .<jsm>create</jsm>()
1330    *       .bpx(<js>"MyBean"</js>, <js>"bar,baz"</js>)
1331    *       .build();
1332    *
1333    *    <jc>// Produces:  {"foo":"foo"}</jc>
1334    *    String json = s.serialize(<jk>new</jk> MyBean());
1335    * </p>
1336    *
1337    * <p>
1338    * This method is functionally equivalent to the following code:
1339    * <p class='bcode w800'>
1340    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClassName).bpx(properties));
1341    * </p>
1342    *
1343    * @param beanClassName
1344    *    The bean class name.
1345    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
1346    * @param properties Comma-delimited list of property names.
1347    * @return This object (for method chaining).
1348    */
1349   @FluentSetter
1350   public BeanContextBuilder bpx(String beanClassName, String properties) {
1351      return prependTo(BEAN_annotations, new BeanAnnotation(beanClassName).bpx(properties));
1352   }
1353
1354   /**
1355    * Read-only bean properties.
1356    *
1357    * <p>
1358    * Specifies one or more properties on a bean that are read-only despite having valid getters.
1359    * Serializers will serialize such properties as usual, but parsers will silently ignore them.
1360    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1361    * for both serializers and parsers.
1362    *
1363    * <h5 class='section'>Example:</h5>
1364    * <p class='bcode w800'>
1365    *    <jc>// A bean with 3 properties.</jc>
1366    *    <jk>public class</jk> MyBean {
1367    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1368    *    }
1369    *
1370    *    <jc>// Create a serializer with read-only property settings.</jc>
1371    *    WriterSerializer s = JsonSerializer
1372    *       .<jsm>create</jsm>()
1373    *       .bpro(MyBean.<jk>class</jk>, <js>"bar,baz"</js>)
1374    *       .build();
1375    *
1376    *    <jc>// All 3 properties will be serialized.</jc>
1377    *    String json = s.serialize(<jk>new</jk> MyBean());
1378    *
1379    *    <jc>// Create a parser with read-only property settings.</jc>
1380    *    ReaderParser p = JsonParser
1381    *       .<jsm>create</jsm>()
1382    *       .bpro(MyBean.<jk>class</jk>, <js>"bar,baz"</js>)
1383    *       .ignoreUnknownBeanProperties()
1384    *       .build();
1385    *
1386    *    <jc>// Parser ignores bar and baz properties.</jc>
1387    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1388    * </p>
1389    *
1390    * <p>
1391    * This method is functionally equivalent to the following code:
1392    * <p class='bcode w800'>
1393    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClass.getName()).bpro(properties));
1394    * </p>
1395    *
1396    * <ul class='seealso'>
1397    *    <li class='jm'>{@link BeanConfig#bpro()}
1398    *    <li class='jm'>{@link Bean#bpro()}
1399    * </ul>
1400    *
1401    * @param beanClass The bean class.
1402    * @param properties Comma-delimited list of property names.
1403    * @return This object (for method chaining).
1404    */
1405   @FluentSetter
1406   public BeanContextBuilder bpro(Class<?> beanClass, String properties) {
1407      return prependTo(BEAN_annotations, new BeanAnnotation(beanClass.getName()).bpro(properties));
1408   }
1409
1410   /**
1411    * Read-only bean properties.
1412    *
1413    * <p>
1414    * Specifies one or more properties on beans that are read-only despite having valid getters.
1415    * Serializers will serialize such properties as usual, but parsers will silently ignore them.
1416    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1417    * for both serializers and parsers.
1418    *
1419    * <h5 class='section'>Example:</h5>
1420    * <p class='bcode w800'>
1421    *    <jc>// A bean with 3 properties.</jc>
1422    *    <jk>public class</jk> MyBean {
1423    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1424    *    }
1425    *
1426    *    <jc>// Create a serializer with read-only property settings.</jc>
1427    *    WriterSerializer s = JsonSerializer
1428    *       .<jsm>create</jsm>()
1429    *       .bpro(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>))
1430    *       .build();
1431    *
1432    *    <jc>// All 3 properties will be serialized.</jc>
1433    *    String json = s.serialize(<jk>new</jk> MyBean());
1434    *
1435    *    <jc>// Create a parser with read-only property settings.</jc>
1436    *    ReaderParser p = JsonParser
1437    *       .<jsm>create</jsm>()
1438    *       .bpro(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>))
1439    *       .ignoreUnknownBeanProperties()
1440    *       .build();
1441    *
1442    *    <jc>// Parser ignores bar and baz properties.</jc>
1443    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1444    * </p>
1445    *
1446    * <p>
1447    * This method is functionally equivalent to the following code for each entry:
1448    * <p class='bcode w800'>
1449    *    builder.annotations(<jk>new</jk> BeanAnnotation(key).bpro(value.toString()));
1450    * </p>
1451    *
1452    * <ul class='seealso'>
1453    *    <li class='jm'>{@link BeanConfig#bpro()}
1454    *    <li class='jm'>{@link Bean#bpro()}
1455    * </ul>
1456    *
1457    * @param values
1458    *    The values to add to this builder.
1459    *    <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
1460    *    <br>Values are comma-delimited lists of property names.  Non-String objects are first converted to Strings.
1461    * @return This object (for method chaining).
1462    */
1463   @FluentSetter
1464   public BeanContextBuilder bpro(Map<String,Object> values) {
1465      for (Map.Entry<String,Object> e : values.entrySet())
1466         prependTo(BEAN_annotations, new BeanAnnotation(e.getKey()).bpro(stringify(e.getValue())));
1467      return this;
1468   }
1469
1470   /**
1471    * Read-only bean properties.
1472    *
1473    * <p>
1474    * Specifies one or more properties on a bean that are read-only despite having valid getters.
1475    * Serializers will serialize such properties as usual, but parsers will silently ignore them.
1476    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1477    * for both serializers and parsers.
1478    *
1479    * <h5 class='section'>Example:</h5>
1480    * <p class='bcode w800'>
1481    *    <jc>// A bean with 3 properties.</jc>
1482    *    <jk>public class</jk> MyBean {
1483    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1484    *    }
1485    *
1486    *    <jc>// Create a serializer with read-only property settings.</jc>
1487    *    WriterSerializer s = JsonSerializer
1488    *       .<jsm>create</jsm>()
1489    *       .bpro(<js>"MyBean"</js>, <js>"bar,baz"</js>)
1490    *       .build();
1491    *
1492    *    <jc>// All 3 properties will be serialized.</jc>
1493    *    String json = s.serialize(<jk>new</jk> MyBean());
1494    *
1495    *    <jc>// Create a parser with read-only property settings.</jc>
1496    *    ReaderParser p = JsonParser
1497    *       .<jsm>create</jsm>()
1498    *       .bpro(<js>"MyBean"</js>, <js>"bar,baz"</js>)
1499    *       .ignoreUnknownBeanProperties()
1500    *       .build();
1501    *
1502    *    <jc>// Parser ignores bar and baz properties.</jc>
1503    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1504    * </p>
1505    *
1506    * <p>
1507    * This method is functionally equivalent to the following code:
1508    * <p class='bcode w800'>
1509    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClass.getName).bpro(properties));
1510    * </p>
1511    *
1512    * <ul class='seealso'>
1513    *    <li class='jm'>{@link BeanConfig#bpro()}
1514    *    <li class='jm'>{@link Bean#bpro()}
1515    * </ul>
1516    *
1517    * @param beanClassName
1518    *    The bean class name.
1519    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
1520    * @param properties Comma-delimited list of property names.
1521    * @return This object (for method chaining).
1522    */
1523   @FluentSetter
1524   public BeanContextBuilder bpro(String beanClassName, String properties) {
1525      return prependTo(BEAN_annotations, new BeanAnnotation(beanClassName).bpro(properties));
1526   }
1527
1528   /**
1529    * Write-only bean properties.
1530    *
1531    * <p>
1532    * Specifies one or more properties on a bean that are write-only despite having valid setters.
1533    * Parsers will parse such properties as usual, but serializers will silently ignore them.
1534    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1535    * for both serializers and parsers.
1536    *
1537    * <h5 class='section'>Example:</h5>
1538    * <p class='bcode w800'>
1539    *    <jc>// A bean with 3 properties.</jc>
1540    *    <jk>public class</jk> MyBean {
1541    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1542    *    }
1543    *
1544    *    <jc>// Create a serializer with write-only property settings.</jc>
1545    *    WriterSerializer s = JsonSerializer
1546    *       .<jsm>create</jsm>()
1547    *       .bpwo(MyBean.<jk>class</jk>, <js>"bar,baz"</js>)
1548    *       .build();
1549    *
1550    *    <jc>// Only foo will be serialized.</jc>
1551    *    String json = s.serialize(<jk>new</jk> MyBean());
1552    *
1553    *    <jc>// Create a parser with write-only property settings.</jc>
1554    *    ReaderParser p = JsonParser
1555    *       .<jsm>create</jsm>()
1556    *       .bpwo(MyBean.<jk>class</jk>, <js>"bar,baz"</js>)
1557    *       .build();
1558    *
1559    *    <jc>// Parser parses all 3 properties.</jc>
1560    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1561    * </p>
1562    *
1563    * <p>
1564    * This method is functionally equivalent to the following code:
1565    * <p class='bcode w800'>
1566    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClass.getName).bpwo(properties));
1567    * </p>
1568    *
1569    * <ul class='seealso'>
1570    *    <li class='jm'>{@link BeanConfig#bpwo()}
1571    *    <li class='jm'>{@link Bean#bpwo()}
1572    * </ul>
1573    *
1574    * @param beanClass The bean class.
1575    * @param properties Comma-delimited list of property names.
1576    * @return This object (for method chaining).
1577    */
1578   @FluentSetter
1579   public BeanContextBuilder bpwo(Class<?> beanClass, String properties) {
1580      return prependTo(BEAN_annotations, new BeanAnnotation(beanClass.getName()).bpwo(properties));
1581   }
1582
1583   /**
1584    * Write-only bean properties.
1585    *
1586    * <p>
1587    * Specifies one or more properties on a bean that are write-only despite having valid setters.
1588    * Parsers will parse such properties as usual, but serializers will silently ignore them.
1589    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1590    * for both serializers and parsers.
1591    *
1592    * <h5 class='section'>Example:</h5>
1593    * <p class='bcode w800'>
1594    *    <jc>// A bean with 3 properties.</jc>
1595    *    <jk>public class</jk> MyBean {
1596    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1597    *    }
1598    *
1599    *    <jc>// Create a serializer with write-only property settings.</jc>
1600    *    WriterSerializer s = JsonSerializer
1601    *       .<jsm>create</jsm>()
1602    *       .bpwo(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>))
1603    *       .build();
1604    *
1605    *    <jc>// Only foo will be serialized.</jc>
1606    *    String json = s.serialize(<jk>new</jk> MyBean());
1607    *
1608    *    <jc>// Create a parser with write-only property settings.</jc>
1609    *    ReaderParser p = JsonParser
1610    *       .<jsm>create</jsm>()
1611    *       .bpwo(AMap.<jsm>of</jsm>(<js>"MyBean"</js>, <js>"bar,baz"</js>))
1612    *       .build();
1613    *
1614    *    <jc>// Parser parses all 3 properties.</jc>
1615    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1616    * </p>
1617    *
1618    * <p>
1619    * This method is functionally equivalent to the following code for each entry:
1620    * <p class='bcode w800'>
1621    *    builder.annotations(<jk>new</jk> BeanAnnotation(key).bpwo(value.toString()));
1622    * </p>
1623    *
1624    * <ul class='seealso'>
1625    *    <li class='jm'>{@link BeanConfig#bpwo()}
1626    *    <li class='jm'>{@link Bean#bpwo()}
1627    * </ul>
1628    *
1629    * @param values
1630    *    The values to add to this builder.
1631    *    <br>Keys are bean class names which can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
1632    *    <br>Values are comma-delimited lists of property names.  Non-String objects are first converted to Strings.
1633    * @return This object (for method chaining).
1634    */
1635   @FluentSetter
1636   public BeanContextBuilder bpwo(Map<String,Object> values) {
1637      for (Map.Entry<String,Object> e : values.entrySet())
1638         prependTo(BEAN_annotations, new BeanAnnotation(e.getKey()).bpwo(stringify(e.getValue())));
1639      return this;
1640   }
1641
1642   /**
1643    * Write-only bean properties.
1644    *
1645    * <p>
1646    * Specifies one or more properties on a bean that are write-only despite having valid setters.
1647    * Parsers will parse such properties as usual, but serializers will silently ignore them.
1648    * Note that this is different from the <l>bpi</l>/<l>bpx</l> settings which include or exclude properties
1649    * for both serializers and parsers.
1650    *
1651    * <h5 class='section'>Example:</h5>
1652    * <p class='bcode w800'>
1653    *    <jc>// A bean with 3 properties.</jc>
1654    *    <jk>public class</jk> MyBean {
1655    *       <jk>public</jk> String <jf>foo</jf>, <jf>bar</jf>, <jf>baz</jf>;
1656    *    }
1657    *
1658    *    <jc>// Create a serializer with write-only property settings.</jc>
1659    *    WriterSerializer s = JsonSerializer
1660    *       .<jsm>create</jsm>()
1661    *       .bpwo(<js>"MyBean"</js>, <js>"bar,baz"</js>)
1662    *       .build();
1663    *
1664    *    <jc>// Only foo will be serialized.</jc>
1665    *    String json = s.serialize(<jk>new</jk> MyBean());
1666    *
1667    *    <jc>// Create a parser with write-only property settings.</jc>
1668    *    ReaderParser p = JsonParser
1669    *       .<jsm>create</jsm>()
1670    *       .bpwo(<js>"MyBean"</js>, <js>"bar,baz"</js>)
1671    *       .build();
1672    *
1673    *    <jc>// Parser parses all 3 properties.</jc>
1674    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar',baz:'baz'}"</js>, MyBean.<jk>class</jk>);
1675    * </p>
1676    *
1677    * <p>
1678    * This method is functionally equivalent to the following code:
1679    * <p class='bcode w800'>
1680    *    builder.annotations(<jk>new</jk> BeanAnnotation(beanClassName).bpwo(properties));
1681    * </p>
1682    *
1683    * <ul class='seealso'>
1684    *    <li class='jm'>{@link BeanConfig#bpwo()}
1685    *    <li class='jm'>{@link Bean#bpwo()}
1686    * </ul>
1687    *
1688    * @param beanClassName
1689    *    The bean class name.
1690    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
1691    * @param properties Comma-delimited list of property names.
1692    * @return This object (for method chaining).
1693    */
1694   @FluentSetter
1695   public BeanContextBuilder bpwo(String beanClassName, String properties) {
1696      return prependTo(BEAN_annotations, new BeanAnnotation(beanClassName).bpwo(properties));
1697   }
1698
1699   /**
1700    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Debug mode.
1701    *
1702    * <div class='warn'>
1703    *    <b>Deprecated</b> - Use {@link #debug()}
1704    * </div>
1705    */
1706   @SuppressWarnings("javadoc")
1707   @Deprecated
1708   @FluentSetter
1709   public BeanContextBuilder debug(boolean value) {
1710      return set(CONTEXT_debug, value);
1711   }
1712
1713   /**
1714    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
1715    *
1716    * <p>
1717    * The list of classes that make up the bean dictionary in this bean context.
1718    *
1719    * <p>
1720    * A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred
1721    * through reflection.  The names are defined through the {@link Bean#typeName() @Bean(typeName)} annotation defined
1722    * 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
1723    * serialized as <js>"{_type:'myfoo',...}"</js> in JSON (depending on <l>addBeanTypes</l>/<l>addRootType</l> properties)
1724    * or <js>"&lt;myfoo&gt;...&lt;/myfoo&gt;"</js> in XML.
1725    *
1726    * <p>
1727    * This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes.
1728    *
1729    * <p>
1730    * Values can consist of any of the following types:
1731    * <ul>
1732    *    <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
1733    *    <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
1734    *    <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
1735    *    <li>Any array or collection of the objects above.
1736    * </ul>
1737    *
1738    * <h5 class='section'>Example:</h5>
1739    * <p class='bcode w800'>
1740    *    <jc>// POJOs with @Bean(name) annotations.</jc>
1741    *    <ja>@Bean</ja>(typeName=<js>"foo"</js>)
1742    *    <jk>public class</jk> Foo {...}
1743    *    <ja>@Bean</ja>(typeName=<js>"bar"</js>)
1744    *    <jk>public class</jk> Bar {...}
1745    *
1746    *    <jc>// Create a parser and tell it which classes to try to resolve.</jc>
1747    *    ReaderParser p = JsonParser
1748    *       .<jsm>create</jsm>()
1749    *       .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>)
1750    *       .addBeanTypes()
1751    *       .build();
1752    *
1753    *    <jc>// Same, but use property.</jc>
1754    *    ReaderParser p = JsonParser
1755    *       .<jsm>create</jsm>()
1756    *       .addTo(<jsf>BEAN_beanDictionary</jsf>, Foo.<jk>class</jk>)
1757    *       .addTo(<jsf>BEAN_beanDictionary</jsf>, Bar.<jk>class</jk>)
1758    *       .set(<jsf>SERIALIZER_addBeanTypes</jsf>, <jk>true</jk>)
1759    *       .build();
1760    *
1761    *    <jc>// A bean with a field with an indeterminate type.</jc>
1762    *    <jk>public class</jk> MyBean {
1763    *       <jk>public</jk> Object <jf>mySimpleField</jf>;
1764    *    }
1765    *
1766    *    <jc>// Parse bean.</jc>
1767    *    MyBean b = p.parse(<js>"{mySimpleField:{_type:'foo',...}}"</js>, MyBean.<jk>class</jk>);
1768    * </p>
1769    *
1770    * <p>
1771    * Another option is to use the {@link Bean#dictionary()} annotation on the POJO class itself:
1772    *
1773    * <p class='bcode w800'>
1774    *    <jc>// Instead of by parser, define a bean dictionary on a class through an annotation.</jc>
1775    *    <jc>// This applies to all properties on this class and all subclasses.</jc>
1776    *    <ja>@Bean</ja>(dictionary={Foo.<jk>class</jk>,Bar.<jk>class</jk>})
1777    *    <jk>public class</jk> MyBean {
1778    *       <jk>public</jk> Object <jf>mySimpleField</jf>;  <jc>// May contain Foo or Bar object.</jc>
1779    *       <jk>public</jk> Map&lt;String,Object&gt; <jf>myMapField</jf>;  <jc>// May contain Foo or Bar objects.</jc>
1780    *    }
1781    * </p>
1782    *
1783    * <p>
1784    *    A typical usage is to allow for HTML documents to be parsed back into HTML beans:
1785    * <p class='bcode w800'>
1786    *    <jc>// Use the predefined HTML5 bean dictionary which is a BeanDictionaryList.</jc>
1787    *    ReaderParser p = HtmlParser
1788    *       .<jsm>create</jsm>()
1789    *       .dictionary(HtmlBeanDictionary.<jk>class</jk>)
1790    *       .build();
1791    *
1792    *    <jc>// Parse an HTML body into HTML beans.</jc>
1793    *    Body body = p.parse(<js>"&lt;body&gt;&lt;ul&gt;&lt;li&gt;foo&lt;/li&gt;&lt;li&gt;bar&lt;/li&gt;&lt;/ul&gt;"</js>, Body.<jk>class</jk>);
1794    * </p>
1795    *
1796    * <ul class='seealso'>
1797    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
1798    * </ul>
1799    *
1800    * @param values
1801    *    The values to add to this property.
1802    * @return This object (for method chaining).
1803    */
1804   @FluentSetter
1805   public BeanContextBuilder dictionary(Object...values) {
1806      return prependTo(BEAN_beanDictionary, values);
1807   }
1808
1809   /**
1810    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean dictionary.
1811    *
1812    * <p>
1813    * This is identical to {@link #dictionary(Object...)}, but specifies a dictionary within the context of
1814    * a single class as opposed to globally.
1815    *
1816    * <h5 class='section'>Example:</h5>
1817    * <p class='bcode w800'>
1818    *    <jc>// POJOs with @Bean(name) annotations.</jc>
1819    *    <ja>@Bean</ja>(typeName=<js>"foo"</js>)
1820    *    <jk>public class</jk> Foo {...}
1821    *    <ja>@Bean</ja>(typeName=<js>"bar"</js>)
1822    *    <jk>public class</jk> Bar {...}
1823    *
1824    *    <jc>// A bean with a field with an indeterminate type.</jc>
1825    *    <jk>public class</jk> MyBean {
1826    *       <jk>public</jk> Object <jf>mySimpleField</jf>;
1827    *    }
1828    *
1829    *    <jc>// Create a parser and tell it which classes to try to resolve.</jc>
1830    *    ReaderParser p = JsonParser
1831    *       .<jsm>create</jsm>()
1832    *       .dictionaryOn(MyBean.class, Foo.<jk>class</jk>, Bar.<jk>class</jk>)
1833    *       .build();
1834    *
1835    *    <jc>// Parse bean.</jc>
1836    *    MyBean b = p.parse(<js>"{mySimpleField:{_type:'foo',...}}"</js>, MyBean.<jk>class</jk>);
1837    * </p>
1838    *
1839    * <p>
1840    * This is functionally equivalent to the {@link Bean#dictionary()} annotation.
1841    *
1842    * <ul class='seealso'>
1843    *    <li class='ja'>{@link Bean#dictionary()}
1844    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
1845    * </ul>
1846    *
1847    * @param on The class that the dictionary values apply to.
1848    * @param values
1849    *    The new values for this property.
1850    * @return This object (for method chaining).
1851    */
1852   @FluentSetter
1853   public BeanContextBuilder dictionaryOn(Class<?> on, Class<?>...values) {
1854      return prependTo(BEAN_annotations, new BeanAnnotation(on).dictionary(values));
1855   }
1856
1857   /**
1858    * <i><l>BeanContext</l> configuration property:&emsp;</i>  POJO example.
1859    *
1860    * <p>
1861    * Specifies an example of the specified class.
1862    *
1863    * <p>
1864    * Examples are used in cases such as POJO examples in Swagger documents.
1865    *
1866    * <p>
1867    * Setting applies to specified class and all subclasses.
1868    *
1869    * <h5 class='section'>Example:</h5>
1870    * <p class='bcode w800'>
1871    *    <jc>// Create a serializer that excludes the 'foo' and 'bar' properties on the MyBean class.</jc>
1872    *    WriterSerializer s = JsonSerializer
1873    *       .<jsm>create</jsm>()
1874    *       .example(MyBean.<jk>class</jk>, <jk>new</jk> MyBean().foo(<js>"foo"</js>).bar(123))
1875    *       .build();
1876    *
1877    *    <jc>// Same, but use property.</jc>
1878    *    WriterSerializer s = JsonSerializer
1879    *       .<jsm>create</jsm>()
1880    *       .addTo(<jsf>BEAN_examples</jsf>, MyBean.<jk>class</jk>.getName(), <jk>new</jk> MyBean().foo(<js>"foo"</js>).bar(123))
1881    *       .build();
1882    * </p>
1883    *
1884    * <p>
1885    * POJO examples can also be defined on classes via the following:
1886    * <ul class='spaced-list'>
1887    *    <li>A static field annotated with {@link Example @Example}.
1888    *    <li>A static method annotated with {@link Example @Example} with zero arguments or one {@link BeanSession} argument.
1889    *    <li>A static method with name <c>example</c> with no arguments or one {@link BeanSession} argument.
1890    * </ul>
1891    *
1892    * <ul class='seealso'>
1893    *    <li class='jf'>{@link BeanContext#BEAN_examples}
1894    * </ul>
1895    *
1896    * @param pojoClass The POJO class.
1897    * @param o An instance of the POJO class used for examples.
1898    * @return This object (for method chaining).
1899    */
1900   @FluentSetter
1901   public <T> BeanContextBuilder example(Class<T> pojoClass, T o) {
1902      return putTo(BEAN_examples, pojoClass.getName(), o);
1903   }
1904
1905   /**
1906    * <i><l>BeanContext</l> configuration property:&emsp;</i>  POJO example.
1907    *
1908    * <p>
1909    * Specifies an example in JSON of the specified class.
1910    *
1911    * <p>
1912    * Examples are used in cases such as POJO examples in Swagger documents.
1913    *
1914    * <p>
1915    * Setting applies to specified class and all subclasses.
1916    *
1917    * <h5 class='section'>Example:</h5>
1918    * <p class='bcode w800'>
1919    *    <jc>// Create a serializer that excludes the 'foo' and 'bar' properties on the MyBean class.</jc>
1920    *    WriterSerializer s = JsonSerializer
1921    *       .<jsm>create</jsm>()
1922    *       .example(MyBean.<jk>class</jk>, <js>"{foo:'bar'}"</js>)
1923    *       .build();
1924    * </p>
1925    *
1926    * <p>
1927    * POJO examples can also be defined on classes via the following:
1928    * <ul class='spaced-list'>
1929    *    <li>A static field annotated with {@link Example @Example}.
1930    *    <li>A static method annotated with {@link Example @Example} with zero arguments or one {@link BeanSession} argument.
1931    *    <li>A static method with name <c>example</c> with no arguments or one {@link BeanSession} argument.
1932    * </ul>
1933    *
1934    * <ul class='seealso'>
1935    *    <li class='jf'>{@link BeanContext#BEAN_examples}
1936    * </ul>
1937    *
1938    * @param <T> The POJO class type.
1939    * @param pojoClass The POJO class.
1940    * @param json The simple JSON representation of the example.
1941    * @return This object (for method chaining).
1942    */
1943   @FluentSetter
1944   public <T> BeanContextBuilder exampleJson(Class<T> pojoClass, String json) {
1945      try {
1946         return putTo(BEAN_examples, pojoClass.getName(), SimpleJson.DEFAULT.read(json, pojoClass));
1947      } catch (ParseException e) {
1948         throw new RuntimeException(e);
1949      }
1950   }
1951
1952   /**
1953    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property excludes.
1954    *
1955    * <div class='warn'>
1956    *    <b>Deprecated</b> - Use {@link #bpx(Class, String)}
1957    * </div>
1958    */
1959   @SuppressWarnings("javadoc")
1960   @FluentSetter
1961   @Deprecated public BeanContextBuilder excludeProperties(Class<?> beanClass, String properties) {
1962      return putTo(BEAN_bpx, beanClass.getName(), properties);
1963   }
1964
1965   /**
1966    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property excludes.
1967    *
1968    * <div class='warn'>
1969    *    <b>Deprecated</b> - Use {@link #bpx(Map)}
1970    * </div>
1971    */
1972   @SuppressWarnings("javadoc")
1973   @FluentSetter
1974   @Deprecated public BeanContextBuilder excludeProperties(Map<String,String> values) {
1975      return set(BEAN_bpx, values);
1976   }
1977
1978   /**
1979    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property excludes.
1980    *
1981    * <div class='warn'>
1982    *    <b>Deprecated</b> - Use {@link #bpx(String, String)}
1983    * </div>
1984    */
1985   @SuppressWarnings("javadoc")
1986   @FluentSetter
1987   @Deprecated public BeanContextBuilder excludeProperties(String beanClassName, String value) {
1988      return putTo(BEAN_bpx, beanClassName, value);
1989   }
1990
1991   /**
1992    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Find fluent setters.
1993    *
1994    * <div class='warn'>
1995    *    <b>Deprecated</b> - Use {@link #fluentSetters()}
1996    * </div>
1997    */
1998   @SuppressWarnings("javadoc")
1999   @Deprecated
2000   @FluentSetter
2001   public BeanContextBuilder fluentSetters(boolean value) {
2002      return set(BEAN_fluentSetters, value);
2003   }
2004
2005   /**
2006    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Find fluent setters.
2007    *
2008    * <p>
2009    * When enabled, fluent setters are detected on beans during parsing.
2010    *
2011    * <p>
2012    * Fluent setters must have the following attributes:
2013    * <ul>
2014    *    <li>Public.
2015    *    <li>Not static.
2016    *    <li>Take in one parameter.
2017    *    <li>Return the bean itself.
2018    * </ul>
2019    *
2020    * <h5 class='section'>Example:</h5>
2021    * <p class='bcode w800'>
2022    *    <jc>// A bean with a fluent setter.</jc>
2023    *    <jk>public class</jk> MyBean {
2024    *       <jk>public</jk> MyBean foo(String value) {...}
2025    *    }
2026    *
2027    *    <jc>// Create a parser that finds fluent setters.</jc>
2028    *    ReaderParser p = JsonParser
2029    *       .<jsm>create</jsm>()
2030    *       .fluentSetters()
2031    *       .build();
2032    *
2033    *    <jc>// Same, but use property.</jc>
2034    *    ReaderParser p = JsonParser
2035    *       .<jsm>create</jsm>()
2036    *       .set(<jsf>BEAN_fluentSetters</jsf>, <jk>true</jk>)
2037    *       .build();
2038    *
2039    *    <jc>// Parse into bean using fluent setter.</jc>
2040    *    MyBean b = p.parse(<js>"{foo:'bar'}"</js>);
2041    * </p>
2042    *
2043    * <ul class='notes'>
2044    *    <li>The {@link Beanp @Beanp} annotation can also be used on methods to individually identify them as fluent setters.
2045    *    <li>The {@link Bean#fluentSetters() @Bean.fluentSetters()} annotation can also be used on classes to specify to look for fluent setters.
2046    * </ul>
2047    *
2048    * <ul class='seealso'>
2049    *    <li class='jf'>{@link BeanContext#BEAN_fluentSetters}
2050    * </ul>
2051    *
2052    * @return This object (for method chaining).
2053    */
2054   @FluentSetter
2055   public BeanContextBuilder fluentSetters() {
2056      return set(BEAN_fluentSetters, true);
2057   }
2058
2059   /**
2060    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Find fluent setters.
2061    *
2062    * <p>
2063    * Identical to {@link #fluentSetters()} but enables it on a specific class only.
2064    *
2065    * <h5 class='section'>Example:</h5>
2066    * <p class='bcode w800'>
2067    *    <jc>// A bean with a fluent setter.</jc>
2068    *    <jk>public class</jk> MyBean {
2069    *       <jk>public</jk> MyBean foo(String value) {...}
2070    *    }
2071    *
2072    *    <jc>// Create a parser that finds fluent setters.</jc>
2073    *    ReaderParser p = JsonParser
2074    *       .<jsm>create</jsm>()
2075    *       .fluentSetters(MyBean.<jk>class</jk>)
2076    *       .build();
2077    *
2078    *    <jc>// Parse into bean using fluent setter.</jc>
2079    *    MyBean b = p.parse(<js>"{foo:'bar'}"</js>);
2080    * </p>
2081    *
2082    * <ul class='notes'>
2083    *    <li>This method is functionally equivalent to using the {@link Bean#fluentSetters()} annotation.
2084    * </ul>
2085    *
2086    * <ul class='seealso'>
2087    *    <li class='ja'>{@link Bean#fluentSetters()}
2088    *    <li class='jf'>{@link BeanContext#BEAN_fluentSetters}
2089    * </ul>
2090    *
2091    * @param on The class that this applies to.
2092    * @return This object (for method chaining).
2093    */
2094   @FluentSetter
2095   public BeanContextBuilder fluentSetters(Class<?> on) {
2096      return prependTo(BEAN_annotations, new BeanAnnotation(on).fluentSetters(true));
2097   }
2098
2099   /**
2100    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore invocation errors on getters.
2101    *
2102    * <div class='warn'>
2103    *    <b>Deprecated</b> - Use {@link #ignoreInvocationExceptionsOnGetters()}
2104    * </div>
2105    */
2106   @SuppressWarnings("javadoc")
2107   @Deprecated
2108   @FluentSetter
2109   public BeanContextBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
2110      return set(BEAN_ignoreInvocationExceptionsOnGetters, value);
2111   }
2112
2113   /**
2114    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore invocation errors on getters.
2115    *
2116    * <p>
2117    * When enabled, errors thrown when calling bean getter methods will silently be ignored.
2118    * Otherwise, a {@code BeanRuntimeException} is thrown.
2119    *
2120    * <h5 class='section'>Example:</h5>
2121    * <p class='bcode w800'>
2122    *    <jc>// A bean with a property that throws an exception.</jc>
2123    *    <jk>public class</jk> MyBean {
2124    *       <jk>public</jk> String getFoo() {
2125    *          <jk>throw new</jk> RuntimeException(<js>"foo"</js>);
2126    *       }
2127    *    }
2128    *
2129    *    <jc>// Create a serializer that ignores bean getter exceptions.</jc>
2130    *    WriterSerializer s = JsonSerializer
2131    *       .<jsm>create</jsm>()
2132    *       .ingoreInvocationExceptionsOnGetters()
2133    *       .build();
2134    *
2135    *    <jc>// Same, but use property.</jc>
2136    *    WriterSerializer s = JsonSerializer
2137    *       .<jsm>create</jsm>()
2138    *       .set(<jsf>BEAN_ignoreInvocationExceptionsOnGetters</jsf>, <jk>true</jk>)
2139    *       .build();
2140    *
2141    *    <jc>// Exception is ignored.</jc>
2142    *    String json = s.serialize(<jk>new</jk> MyBean());
2143    * </p>
2144    *
2145    * <ul class='seealso'>
2146    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnGetters}
2147    * </ul>
2148    *
2149    * @return This object (for method chaining).
2150    */
2151   @FluentSetter
2152   public BeanContextBuilder ignoreInvocationExceptionsOnGetters() {
2153      return set(BEAN_ignoreInvocationExceptionsOnGetters, true);
2154   }
2155
2156   /**
2157    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore invocation errors on setters.
2158    *
2159    * <div class='warn'>
2160    *    <b>Deprecated</b> - Use {@link #ignoreInvocationExceptionsOnSetters()}
2161    * </div>
2162    */
2163   @SuppressWarnings("javadoc")
2164   @Deprecated
2165   @FluentSetter
2166   public BeanContextBuilder ignoreInvocationExceptionsOnSetters(boolean value) {
2167      return set(BEAN_ignoreInvocationExceptionsOnSetters, value);
2168   }
2169
2170   /**
2171    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore invocation errors on setters.
2172    *
2173    * <p>
2174    * When enabled, errors thrown when calling bean setter methods will silently be ignored.
2175    * Otherwise, a {@code BeanRuntimeException} is thrown.
2176    *
2177    * <h5 class='section'>Example:</h5>
2178    * <p class='bcode w800'>
2179    *    <jc>// A bean with a property that throws an exception.</jc>
2180    *    <jk>public class</jk> MyBean {
2181    *       <jk>public void</jk> setFoo(String foo) {
2182    *          <jk>throw new</jk> RuntimeException(<js>"foo"</js>);
2183    *       }
2184    *    }
2185    *
2186    *    <jc>// Create a parser that ignores bean setter exceptions.</jc>
2187    *    ReaderParser p = JsonParser
2188    *       .<jsm>create</jsm>()
2189    *       .ignoreInvocationExceptionsOnSetters()
2190    *       .build();
2191    *
2192    *    <jc>// Same, but use property.</jc>
2193    *    ReaderParser p = JsonParser
2194    *       .<jsm>create</jsm>()
2195    *       .set(<jsf>BEAN_ignoreInvocationExceptionsOnSetters</jsf>, <jk>true</jk>)
2196    *       .build();
2197    *
2198    *    <jc>// Exception is ignored.</jc>
2199    *    MyBean b = p.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>);
2200    * </p>
2201    *
2202    * <ul class='seealso'>
2203    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnSetters}
2204    * </ul>
2205    *
2206    * @return This object (for method chaining).
2207    */
2208   @FluentSetter
2209   public BeanContextBuilder ignoreInvocationExceptionsOnSetters() {
2210      return set(BEAN_ignoreInvocationExceptionsOnSetters, true);
2211   }
2212
2213   /**
2214    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore properties without setters.
2215    *
2216    * <div class='warn'>
2217    *    <b>Deprecated</b> - Use {@link #dontIgnorePropertiesWithoutSetters()}
2218    * </div>
2219    */
2220   @SuppressWarnings("javadoc")
2221   @Deprecated
2222   @FluentSetter
2223   public BeanContextBuilder ignorePropertiesWithoutSetters(boolean value) {
2224      return set(BEAN_ignorePropertiesWithoutSetters, value);
2225   }
2226
2227   /**
2228    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore properties without setters.
2229    *
2230    * <p>
2231    * When enabled, trying to set a value on a bean property without a setter will silently be ignored.
2232    * Otherwise, a {@code BeanRuntimeException} is thrown.
2233    *
2234    * <h5 class='section'>Example:</h5>
2235    * <p class='bcode w800'>
2236    *    <jc>// A bean with a property with a getter but not a setter.</jc>
2237    *    <jk>public class</jk> MyBean {
2238    *       <jk>public void</jk> getFoo() {
2239    *          <jk>return</jk> <js>"foo"</js>;
2240    *       }
2241    *    }
2242    *
2243    *    <jc>// Create a parser that throws an exception if a setter is not found but a getter is.</jc>
2244    *    ReaderParser p = JsonParser
2245    *       .<jsm>create</jsm>()
2246    *       .dontIgnorePropertiesWithoutSetters()
2247    *       .build();
2248    *
2249    *    <jc>// Same, but use property.</jc>
2250    *    ReaderParser p = JsonParser
2251    *       .<jsm>create</jsm>()
2252    *       .set(<jsf>BEAN_ignorePropertiesWithoutSetters</jsf>, <jk>false</jk>)
2253    *       .build();
2254    *
2255    *    <jc>// Throws a ParseException.</jc>
2256    *    MyBean b = p.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>);
2257    * </p>
2258    *
2259    * <ul class='notes'>
2260    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on getters and fields to ignore them.
2261    * </ul>
2262    *
2263    * <ul class='seealso'>
2264    *    <li class='jf'>{@link BeanContext#BEAN_ignorePropertiesWithoutSetters}
2265    * </ul>
2266    *
2267    * @return This object (for method chaining).
2268    */
2269   @FluentSetter
2270   public BeanContextBuilder dontIgnorePropertiesWithoutSetters() {
2271      return set(BEAN_ignorePropertiesWithoutSetters, false);
2272   }
2273
2274   /**
2275    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore transient fields.
2276    *
2277    * <div class='warn'>
2278    *    <b>Deprecated</b> - Use {@link #dontIgnoreTransientFields()}
2279    * </div>
2280    */
2281   @SuppressWarnings("javadoc")
2282   @Deprecated
2283   @FluentSetter
2284   public BeanContextBuilder ignoreTransientFields(boolean value) {
2285      return set(BEAN_ignoreTransientFields, value);
2286   }
2287
2288   /**
2289    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore transient fields.
2290    *
2291    * <p>
2292    * When enabled, methods and fields marked as <jk>transient</jk> will be ignored as bean properties.
2293    *
2294    * <h5 class='section'>Example:</h5>
2295    * <p class='bcode w800'>
2296    *    <jc>// A bean with a transient field.</jc>
2297    *    <jk>public class</jk> MyBean {
2298    *       <jk>public transient</jk> String <jf>foo</jf> = <js>"foo"</js>;
2299    *    }
2300    *
2301    *    <jc>// Create a parser that doesn't ignore transient fields.</jc>
2302    *    ReaderParser p = JsonParser
2303    *       .<jsm>create</jsm>()
2304    *       .dontIgnoreTransientFields()
2305    *       .build();
2306    *
2307    *    <jc>// Same, but use property.</jc>
2308    *    ReaderParser p = JsonParser
2309    *       .<jsm>create</jsm>()
2310    *       .set(<jsf>BEAN_ignoreTransientFields</jsf>, <jk>false</jk>)
2311    *       .build();
2312    *
2313    *    <jc>// Produces:  {"foo":"foo"}</jc>
2314    *    String json = s.serialize(<jk>new</jk> MyBean());
2315    * </p>
2316    *
2317    * <ul class='notes'>
2318    *    <li>The {@link Beanp @Beanp} annotation can also be used on transient fields to keep them from being ignored.
2319    * </ul>
2320    *
2321    * <ul class='seealso'>
2322    *    <li class='jf'>{@link BeanContext#BEAN_ignoreTransientFields}
2323    * </ul>
2324    *
2325    * @return This object (for method chaining).
2326    */
2327   @FluentSetter
2328   public BeanContextBuilder dontIgnoreTransientFields() {
2329      return set(BEAN_ignoreTransientFields, false);
2330   }
2331
2332   /**
2333    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore unknown properties.
2334    *
2335    * <div class='warn'>
2336    *    <b>Deprecated</b> - Use {@link #ignoreUnknownBeanProperties()}
2337    * </div>
2338    */
2339   @SuppressWarnings("javadoc")
2340   @Deprecated
2341   @FluentSetter
2342   public BeanContextBuilder ignoreUnknownBeanProperties(boolean value) {
2343      return set(BEAN_ignoreUnknownBeanProperties, value);
2344   }
2345
2346   /**
2347    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore unknown properties.
2348    *
2349    * <p>
2350    * When enabled, trying to set a value on a non-existent bean property will silently be ignored.
2351    * Otherwise, a {@code BeanRuntimeException} is thrown.
2352    *
2353    * <h5 class='section'>Example:</h5>
2354    * <p class='bcode w800'>
2355    *    <jc>// A bean with a single property.</jc>
2356    *    <jk>public class</jk> MyBean {
2357    *       <jk>public</jk> String <jf>foo</jf>;
2358    *    }
2359    *
2360    *    <jc>// Create a parser that ignores missing bean properties.</jc>
2361    *    ReaderParser p = JsonParser
2362    *       .<jsm>create</jsm>()
2363    *       .ignoreUnknownBeanProperties()
2364    *       .build();
2365    *
2366    *    <jc>// Same, but use property.</jc>
2367    *    ReaderParser p = JsonParser
2368    *       .<jsm>create</jsm>()
2369    *       .set(<jsf>BEAN_ignoreUnknownBeanProperties</jsf>, <jk>true</jk>)
2370    *       .build();
2371    *
2372    *    <jc>// Doesn't throw an exception on unknown 'bar' property.</jc>
2373    *    MyBean b = p.parse(<js>"{foo:'foo',bar:'bar'}"</js>, MyBean.<jk>class</jk>);
2374    * </p>
2375    *
2376    * <ul class='seealso'>
2377    *    <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownBeanProperties}
2378    * </ul>
2379    *
2380    * @return This object (for method chaining).
2381    */
2382   @FluentSetter
2383   public BeanContextBuilder ignoreUnknownBeanProperties() {
2384      return set(BEAN_ignoreUnknownBeanProperties, true);
2385   }
2386
2387   /**
2388    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore unknown properties with null values.
2389    *
2390    * <div class='warn'>
2391    *    <b>Deprecated</b> - Use {@link #dontIgnoreUnknownNullBeanProperties()}
2392    * </div>
2393    */
2394   @SuppressWarnings("javadoc")
2395   @Deprecated
2396   @FluentSetter
2397   public BeanContextBuilder ignoreUnknownNullBeanProperties(boolean value) {
2398      return set(BEAN_ignoreUnknownNullBeanProperties, value);
2399   }
2400
2401   /**
2402    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Ignore unknown properties with null values.
2403    *
2404    * <p>
2405    * When enabled, trying to set a <jk>null</jk> value on a non-existent bean property will silently be ignored.
2406    * Otherwise, a {@code BeanRuntimeException} is thrown.
2407    *
2408    * <h5 class='section'>Example:</h5>
2409    * <p class='bcode w800'>
2410    *    <jc>// A bean with a single property.</jc>
2411    *    <jk>public class</jk> MyBean {
2412    *       <jk>public</jk> String <jf>foo</jf>;
2413    *    }
2414    *
2415    *    <jc>// Create a parser that throws an exception on an unknown property even if the value being set is null.</jc>
2416    *    ReaderParser p = JsonParser
2417    *       .<jsm>create</jsm>()
2418    *       .dontIgnoreUnknownNullBeanProperties()
2419    *       .build();
2420    *
2421    *    <jc>// Same, but use property.</jc>
2422    *    ReaderParser p = JsonParser
2423    *       .<jsm>create</jsm>()
2424    *       .set(<jsf>BEAN_ignoreUnknownNullBeanProperties</jsf>, <jk>false</jk>)
2425    *       .build();
2426    *
2427    *    <jc>// Throws a BeanRuntimeException wrapped in a ParseException on the unknown 'bar' property.</jc>
2428    *    MyBean b = p.parse(<js>"{foo:'foo',bar:null}"</js>, MyBean.<jk>class</jk>);
2429    * </p>
2430    *
2431    * <ul class='seealso'>
2432    *    <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownNullBeanProperties}
2433    * </ul>
2434    *
2435    * @return This object (for method chaining).
2436    */
2437   @FluentSetter
2438   public BeanContextBuilder dontIgnoreUnknownNullBeanProperties() {
2439      return set(BEAN_ignoreUnknownNullBeanProperties, false);
2440   }
2441
2442   /**
2443    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Implementation classes.
2444    *
2445    * <p>
2446    * For interfaces and abstract classes this method can be used to specify an implementation class for the
2447    * interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a
2448    * parse).
2449    *
2450    * <h5 class='section'>Example:</h5>
2451    * <p class='bcode w800'>
2452    *    <jc>// A bean interface.</jc>
2453    *    <jk>public interface</jk> MyBean {
2454    *       ...
2455    *    }
2456    *
2457    *    <jc>// A bean implementation.</jc>
2458    *    <jk>public class</jk> MyBeanImpl <jk>implements</jk> MyBean {
2459    *       ...
2460    *    }
2461
2462    *    <jc>// Create a parser that instantiates MyBeanImpls when parsing MyBeans.</jc>
2463    *    ReaderParser p = JsonParser
2464    *       .<jsm>create</jsm>()
2465    *       .implClass(MyBean.<jk>class</jk>, MyBeanImpl.<jk>class</jk>)
2466    *       .build();
2467    *
2468    *    <jc>// Same, but use property.</jc>
2469    *    ReaderParser p = JsonParser
2470    *       .<jsm>create</jsm>()
2471    *       .addTo(<jsf>BEAN_implClasses</jsf>, MyBean.<jk>class</jk>.getName(), MyBeanImpl.<jk>class</jk>)
2472    *       .build();
2473    *
2474    *    <jc>// Instantiates a MyBeanImpl,</jc>
2475    *    MyBean b = p.parse(<js>"..."</js>, MyBean.<jk>class</jk>);
2476    * </p>
2477    *
2478    * <ul class='seealso'>
2479    *    <li class='jf'>{@link BeanContext#BEAN_implClasses}
2480    * </ul>
2481    *
2482    * @param interfaceClass The interface class.
2483    * @param implClass The implementation class.
2484    * @return This object (for method chaining).
2485    */
2486   @FluentSetter
2487   public BeanContextBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
2488      return putTo(BEAN_implClasses, interfaceClass.getName(), implClass);
2489   }
2490
2491   /**
2492    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Implementation classes.
2493    *
2494    * <p>
2495    * For interfaces and abstract classes this method can be used to specify an implementation class for the
2496    * interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a
2497    * parse).
2498    *
2499    * <h5 class='section'>Example:</h5>
2500    * <p class='bcode w800'>
2501    *    <jc>// A bean with a single property.</jc>
2502    *    <jk>public interface</jk> MyBean {
2503    *       ...
2504    *    }
2505    *
2506    *    <jc>// A bean with a single property.</jc>
2507    *    <jk>public class</jk> MyBeanImpl <jk>implements</jk> MyBean {
2508    *       ...
2509    *    }
2510
2511    *    <jc>// Create a parser that instantiates MyBeanImpls when parsing MyBeans.</jc>
2512    *    ReaderParser p = JsonParser
2513    *       .<jsm>create</jsm>()
2514    *       .implClasses(AMap.<jsm>of</jsm>(MyBean.<jk>class</jk>, MyBeanImpl.<jk>class</jk>))
2515    *       .build();
2516    *
2517    *    <jc>// Same, but use property.</jc>
2518    *    ReaderParser p = JsonParser
2519    *       .<jsm>create</jsm>()
2520    *       .addTo(<jsf>BEAN_implClasses</jsf>, AMap.<jsm>of</jsm>(MyBean.<jk>class</jk>.getName(), MyBeanImpl.<jk>class</jk>))
2521    *       .build();
2522    *
2523    *    <jc>// Instantiates a MyBeanImpl,</jc>
2524    *    MyBean b = p.parse(<js>"..."</js>, MyBean.<jk>class</jk>);
2525    * </p>
2526    *
2527    * <ul class='seealso'>
2528    *    <li class='jf'>{@link BeanContext#BEAN_implClasses}
2529    * </ul>
2530    *
2531    * @param values
2532    *    The new value for this property.
2533    * @return This object (for method chaining).
2534    */
2535   @FluentSetter
2536   public BeanContextBuilder implClasses(Map<Class<?>,Class<?>> values) {
2537      for (Map.Entry<Class<?>,Class<?>> e : values.entrySet())
2538         putTo(BEAN_implClasses, e.getKey().getName(), e.getValue());
2539      return this;
2540   }
2541
2542   /**
2543    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property includes.
2544    *
2545    * <div class='warn'>
2546    *    <b>Deprecated</b> - Use {@link #bpi(Class, String)}
2547    * </div>
2548    */
2549   @SuppressWarnings("javadoc")
2550   @FluentSetter
2551   @Deprecated public BeanContextBuilder includeProperties(Class<?> beanClass, String value) {
2552      return putTo(BEAN_bpi, beanClass.getName(), value);
2553   }
2554
2555   /**
2556    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property includes.
2557    *
2558    * <div class='warn'>
2559    *    <b>Deprecated</b> - Use {@link #bpi(Map)}
2560    * </div>
2561    */
2562   @SuppressWarnings("javadoc")
2563   @FluentSetter
2564   @Deprecated public BeanContextBuilder includeProperties(Map<String,String> values) {
2565      return set(BEAN_bpi, values);
2566   }
2567
2568   /**
2569    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property includes.
2570    *
2571    * <div class='warn'>
2572    *    <b>Deprecated</b> - Use {@link #bpi(String, String)}
2573    * </div>
2574    */
2575   @SuppressWarnings("javadoc")
2576   @FluentSetter
2577   @Deprecated public BeanContextBuilder includeProperties(String beanClassName, String value) {
2578      return putTo(BEAN_bpi, beanClassName, value);
2579   }
2580
2581   /**
2582    * Identifies a class to be used as the interface class for the specified class and all subclasses.
2583    *
2584    * <p>
2585    * When specified, only the list of properties defined on the interface class will be used during serialization.
2586    * Additional properties on subclasses will be ignored.
2587    *
2588    * <p class='bcode w800'>
2589    *    <jc>// Parent class or interface</jc>
2590    *    <jk>public abstract class</jk> A {
2591    *       <jk>public</jk> String <jf>foo</jf> = <js>"foo"</js>;
2592    *    }
2593    *
2594    *    <jc>// Sub class</jc>
2595    *    <jk>public class</jk> A1 <jk>extends</jk> A {
2596    *       <jk>public</jk> String <jf>bar</jf> = <js>"bar"</js>;
2597    *    }
2598    *
2599    *    <jc>// Create a serializer and define our interface class mapping.</jc>
2600    *    WriterSerializer s = JsonSerializer
2601    *       .<jsm>create</jsm>()
2602    *       .interfaceClass(A1.<jk>class</jk>, A.<jk>class</jk>)
2603    *       .build();
2604    *
2605    *    <jc>// Produces "{"foo":"foo"}"</jc>
2606    *    String json = s.serialize(<jk>new</jk> A1());
2607    * </p>
2608    *
2609    * <p>
2610    * This annotation can be used on the parent class so that it filters to all child classes, or can be set
2611    * individually on the child classes.
2612    *
2613    * <ul class='notes'>
2614    *    <li>The {@link Bean#interfaceClass() @Bean(interfaceClass)} annotation is the equivalent annotation-based solution.
2615    * </ul>
2616    *
2617    * @param on The class that the interface class applies to.
2618    * @param value
2619    *    The new value for this property.
2620    * @return This object (for method chaining).
2621    */
2622   @FluentSetter
2623   public BeanContextBuilder interfaceClass(Class<?> on, Class<?> value) {
2624      return prependTo(BEAN_annotations, new BeanAnnotation(on).interfaceClass(value));
2625   }
2626
2627   /**
2628    * Identifies a set of interfaces.
2629    *
2630    * <p>
2631    * When specified, only the list of properties defined on the interface class will be used during serialization
2632    * of implementation classes.  Additional properties on subclasses will be ignored.
2633    *
2634    * <p class='bcode w800'>
2635    *    <jc>// Parent class or interface</jc>
2636    *    <jk>public abstract class</jk> A {
2637    *       <jk>public</jk> String <jf>foo</jf> = <js>"foo"</js>;
2638    *    }
2639    *
2640    *    <jc>// Sub class</jc>
2641    *    <jk>public class</jk> A1 <jk>extends</jk> A {
2642    *       <jk>public</jk> String <jf>bar</jf> = <js>"bar"</js>;
2643    *    }
2644    *
2645    *    <jc>// Create a serializer and define our interface class mapping.</jc>
2646    *    WriterSerializer s = JsonSerializer
2647    *       .<jsm>create</jsm>()
2648    *       .interfaces(A.<jk>class</jk>)
2649    *       .build();
2650    *
2651    *    <jc>// Produces "{"foo":"foo"}"</jc>
2652    *    String json = s.serialize(<jk>new</jk> A1());
2653    * </p>
2654    *
2655    * <p>
2656    * This annotation can be used on the parent class so that it filters to all child classes, or can be set
2657    * individually on the child classes.
2658    *
2659    * <ul class='notes'>
2660    *    <li>The {@link Bean#interfaceClass() @Bean(interfaceClass)} annotation is the equivalent annotation-based solution.
2661    * </ul>
2662    *
2663    * @param value
2664    *    The new value for this property.
2665    * @return This object (for method chaining).
2666    */
2667   @FluentSetter
2668   public BeanContextBuilder interfaces(Class<?>...value) {
2669      for (Class<?> v : value)
2670         prependTo(BEAN_annotations, new BeanAnnotation(v).interfaceClass(v));
2671      return this;
2672   }
2673
2674   /**
2675    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean class exclusions.
2676    *
2677    * <p>
2678    * List of classes that should not be treated as beans even if they appear to be bean-like.
2679    * Not-bean classes are converted to <c>Strings</c> during serialization.
2680    *
2681    * <p>
2682    * Values can consist of any of the following types:
2683    * <ul>
2684    *    <li>Classes.
2685    *    <li>Arrays and collections of classes.
2686    * </ul>
2687    *
2688    * <h5 class='section'>Example:</h5>
2689    * <p class='bcode w800'>
2690    *    <jc>// A bean with a single property.</jc>
2691    *    <jk>public class</jk> MyBean {
2692    *       <jk>public</jk> String <jf>foo</jf> = <js>"bar"</js>;
2693    *
2694    *       <jk>public</jk> String toString() {
2695    *          <jk>return</jk> <js>"baz"</js>;
2696    *       }
2697    *    }
2698    *
2699    *    <jc>// Create a serializer that doesn't treat MyBean as a bean class.</jc>
2700    *    WriterSerializer s = JsonSerializer
2701    *       .<jsm>create</jsm>()
2702    *       .notBeanClasses(MyBean.<jk>class</jk>)
2703    *       .build();
2704    *
2705    *    <jc>// Same, but use property.</jc>
2706    *    WriterSerializer s = JsonSerializer
2707    *       .<jsm>create</jsm>()
2708    *       .addTo(<jsf>BEAN_notBeanClasses</jsf>, MyBean.<jk>class</jk>)
2709    *       .build();
2710    *
2711    *    <jc>// Produces "baz" instead of {"foo":"bar"}</jc>
2712    *    String json = s.serialize(<jk>new</jk> MyBean());
2713    * </p>
2714    *
2715    * <ul class='notes'>
2716    *    <li>The {@link BeanIgnore @BeanIgnore} annotation can also be used on classes to prevent them from being recognized as beans.
2717    * </ul>
2718    *
2719    * <ul class='seealso'>
2720    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
2721    * </ul>
2722    *
2723    * @param values
2724    *    The values to add to this property.
2725    *    <br>Values can consist of any of the following types:
2726    *    <ul>
2727    *       <li>Classes.
2728    *       <li>Arrays and collections of classes.
2729    *    </ul>
2730    * @return This object (for method chaining).
2731    */
2732   @FluentSetter
2733   public BeanContextBuilder notBeanClasses(Object...values) {
2734      return addTo(BEAN_notBeanClasses, values);
2735   }
2736
2737   /**
2738    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean package exclusions.
2739    *
2740    * <p>
2741    * Used as a convenient way of defining the {@link #notBeanClasses(Object...)} property for entire packages.
2742    * Any classes within these packages will be serialized to strings using {@link Object#toString()}.
2743    *
2744    * <p>
2745    * Note that you can specify suffix patterns to include all subpackages.
2746    *
2747    * <p>
2748    * Values can consist of any of the following types:
2749    * <ul>
2750    *    <li>Strings.
2751    *    <li>Arrays and collections of strings.
2752    * </ul>
2753    *
2754    * <h5 class='section'>Example:</h5>
2755    * <p class='bcode w800'>
2756    *    <jc>// Create a serializer that ignores beans in the specified packages.</jc>
2757    *    WriterSerializer s = JsonSerializer
2758    *       .<jsm>create</jsm>()
2759    *       .notBeanPackages(<js>"org.apache.foo"</js>, <js>"org.apache.bar.*"</js>)
2760    *       .build();
2761    *
2762    *    <jc>// Same, but use property.</jc>
2763    *    WriterSerializer s = JsonSerializer
2764    *       .<jsm>create</jsm>()
2765    *       .addTo(<jsf>BEAN_notBeanPackages</jsf>, <js>"org.apache.foo"</js>)
2766    *       .addTo(<jsf>BEAN_notBeanPackages</jsf>, <js>"org.apache.bar.*"</js>)
2767    *       .build();
2768    * </p>
2769    *
2770    * <ul class='seealso'>
2771    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
2772    * </ul>
2773    *
2774    * @param values
2775    *    The values to add to this property.
2776    *    <br>Values can consist of any of the following types:
2777    *    <ul>
2778    *       <li>{@link Package} objects.
2779    *       <li>Strings.
2780    *       <li>Arrays and collections of anything in this list.
2781    *    </ul>
2782    * @return This object (for method chaining).
2783    */
2784   @FluentSetter
2785   public BeanContextBuilder notBeanPackages(Object...values) {
2786      for (Object o : values) {
2787         if (o instanceof Package)
2788            addTo(BEAN_notBeanPackages, ((Package) o).getName());
2789         else if (o instanceof String)
2790            addTo(BEAN_notBeanPackages, o.toString());
2791         else if (o instanceof Collection) {
2792            for (Object o2 : (Collection<?>)o)
2793               notBeanPackages(o2);
2794         } else if (o.getClass().isArray()) {
2795            for (int i = 0; i < Array.getLength(o); i++)
2796               notBeanPackages(Array.get(o, i));
2797         }
2798      }
2799      return this;
2800   }
2801
2802   /**
2803    * <i><l>BeanContext</l> configuration property:&emsp;</i>  POJO swaps.
2804    *
2805    * <div class='warn'>
2806    *    <b>Deprecated</b> - Use {@link #swaps(Object...)}
2807    * </div>
2808    */
2809   @SuppressWarnings("javadoc")
2810   @Deprecated
2811   @FluentSetter
2812   public BeanContextBuilder pojoSwaps(Object...values) {
2813      return appendTo(BEAN_pojoSwaps, values);
2814   }
2815
2816   /**
2817    * <i><l>BeanContext</l> configuration property:&emsp;</i>  POJO swaps.
2818    *
2819    * <div class='warn'>
2820    *    <b>Deprecated</b> - Use {@link #set(String,Object)}
2821    * </div>
2822    */
2823   @SuppressWarnings("javadoc")
2824   @Deprecated
2825   @FluentSetter
2826   public BeanContextBuilder pojoSwapsReplace(Object...values) {
2827      return set(BEAN_pojoSwaps, values);
2828   }
2829
2830   /**
2831    * <i><l>BeanContext</l> configuration property:&emsp;</i>  POJO swaps.
2832    *
2833    * <div class='warn'>
2834    *    <b>Deprecated</b> - Use {@link #removeFrom(String,Object)}
2835    * </div>
2836    */
2837   @SuppressWarnings("javadoc")
2838   @Deprecated
2839   @FluentSetter
2840   public BeanContextBuilder pojoSwapsRemove(Object...values) {
2841      return removeFrom(BEAN_pojoSwaps, values);
2842   }
2843
2844   /**
2845    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean property namer
2846    *
2847    * <p>
2848    * The class to use for calculating bean property names.
2849    *
2850    * <p>
2851    * Predefined classes:
2852    * <ul>
2853    *    <li>{@link PropertyNamerDefault} - Default.
2854    *    <li>{@link PropertyNamerDLC} - Dashed-lower-case names.
2855    *    <li>{@link PropertyNamerULC} - Dashed-upper-case names.
2856    * </ul>
2857    *
2858    * <h5 class='section'>Example:</h5>
2859    * <p class='bcode w800'>
2860    *    <jc>// A bean with a single property.</jc>
2861    *    <jk>public class</jk> MyBean {
2862    *       <jk>public</jk> String <jf>fooBarBaz</jf> = <js>"fooBarBaz"</js>;
2863    *    }
2864    *
2865    *    <jc>// Create a serializer that uses Dashed-Lower-Case property names.</jc>
2866    *    <jc>// (e.g. "foo-bar-baz" instead of "fooBarBaz")</jc>
2867    *    WriterSerializer s = JsonSerializer
2868    *       .<jsm>create</jsm>()
2869    *       .propertyNamer(PropertyNamerDLC.<jk>class</jk>)
2870    *       .build();
2871    *
2872    *    <jc>// Same, but use property.</jc>
2873    *    WriterSerializer s = JsonSerializer
2874    *       .<jsm>create</jsm>()
2875    *       .set(<jsf>BEAN_propertyNamer</jsf>, PropertyNamerDLC.<jk>class</jk>)
2876    *       .build();
2877    *
2878    *    <jc>// Produces:  {"foo-bar-baz":"fooBarBaz"}</jc>
2879    *    String json = s.serialize(<jk>new</jk> MyBean());
2880    * </p>
2881    *
2882    * <ul class='seealso'>
2883    *    <li class='jf'>{@link BeanContext#BEAN_propertyNamer}
2884    * </ul>
2885    *
2886    * @param value
2887    *    The new value for this setting.
2888    *    <br>The default is {@link PropertyNamerDefault}.
2889    * @return This object (for method chaining).
2890    */
2891   @FluentSetter
2892   public BeanContextBuilder propertyNamer(Class<? extends PropertyNamer> value) {
2893      return set(BEAN_propertyNamer, value);
2894   }
2895
2896   /**
2897    * Bean property namer
2898    *
2899    * <p>
2900    * Same as {@link #propertyNamer(Class)} but allows you to specify a namer for a specific class.
2901    *
2902    * <h5 class='section'>Example:</h5>
2903    * <p class='bcode w800'>
2904    *    <jc>// A bean with a single property.</jc>
2905    *    <jk>public class</jk> MyBean {
2906    *       <jk>public</jk> String <jf>fooBarBaz</jf> = <js>"fooBarBaz"</js>;
2907    *    }
2908    *
2909    *    <jc>// Create a serializer that uses Dashed-Lower-Case property names for the MyBean class only.</jc>
2910    *    <jc>// (e.g. "foo-bar-baz" instead of "fooBarBaz")</jc>
2911    *    WriterSerializer s = JsonSerializer
2912    *       .<jsm>create</jsm>()
2913    *       .propertyNamer(MyBean.<jk>class</jk>, PropertyNamerDLC.<jk>class</jk>)
2914    *       .build();
2915    *
2916    *    <jc>// Produces:  {"foo-bar-baz":"fooBarBaz"}</jc>
2917    *    String json = s.serialize(<jk>new</jk> MyBean());
2918    * </p>
2919    *
2920    * <ul class='seealso'>
2921    *    <li class='ja'>{@link Bean#propertyNamer() Bean(propertyNamer)}
2922    *    <li class='jf'>{@link BeanContext#BEAN_propertyNamer}
2923    * </ul>
2924    *
2925    * @param on The class that the namer applies to.
2926    * @param value
2927    *    The new value for this setting.
2928    *    <br>The default is {@link PropertyNamerDefault}.
2929    * @return This object (for method chaining).
2930    */
2931   @FluentSetter
2932   public BeanContextBuilder propertyNamer(Class<?> on, Class<? extends PropertyNamer> value) {
2933      return prependTo(BEAN_annotations, new BeanAnnotation(on).propertyNamer(value));
2934   }
2935
2936   /**
2937    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Sort bean properties.
2938    *
2939    * <div class='warn'>
2940    *    <b>Deprecated</b> - Use {@link #sortProperties()}
2941    * </div>
2942    */
2943   @SuppressWarnings("javadoc")
2944   @Deprecated
2945   @FluentSetter
2946   public BeanContextBuilder sortProperties(boolean value) {
2947      return set(BEAN_sortProperties, value);
2948   }
2949
2950   /**
2951    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Sort bean properties.
2952    *
2953    * <p>
2954    * When enabled, all bean properties will be serialized and access in alphabetical order.
2955    * Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
2956    * On IBM JVMs, the bean properties are ordered based on their ordering in the Java file.
2957    * On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs).
2958    *
2959    * <p>
2960    * This property is disabled by default so that IBM JVM users don't have to use {@link Bean @Bean} annotations
2961    * to force bean properties to be in a particular order and can just alter the order of the fields/methods
2962    * in the Java file.
2963    *
2964    * <h5 class='section'>Example:</h5>
2965    * <p class='bcode w800'>
2966    *    <jc>// A bean with 3 properties.</jc>
2967    *    <jk>public class</jk> MyBean {
2968    *       <jk>public</jk> String <jf>c</jf> = <js>"1"</js>;
2969    *       <jk>public</jk> String <jf>b</jf> = <js>"2"</js>;
2970    *       <jk>public</jk> String <jf>a</jf> = <js>"3"</js>;
2971    *    }
2972    *
2973    *    <jc>// Create a serializer that sorts bean properties.</jc>
2974    *    WriterSerializer s = JsonSerializer
2975    *       .<jsm>create</jsm>()
2976    *       .sortProperties()
2977    *       .build();
2978    *
2979    *    <jc>// Same, but use property.</jc>
2980    *    WriterSerializer s = JsonSerializer
2981    *       .<jsm>create</jsm>()
2982    *       .set(<jsf>BEAN_sortProperties</jsf>, <jk>true</jk>)
2983    *       .build();
2984    *
2985    *    <jc>// Produces:  {"a":"3","b":"2","c":"1"}</jc>
2986    *    String json = s.serialize(<jk>new</jk> MyBean());
2987    * </p>
2988    *
2989    * <ul class='notes'>
2990    *    <li>The {@link Bean#sort() @Bean.sort()} annotation can also be used to sort properties on just a single class.
2991    * </ul>
2992    *
2993    * <ul class='seealso'>
2994    *    <li class='jf'>{@link BeanContext#BEAN_sortProperties}
2995    * </ul>
2996    *
2997    * @return This object (for method chaining).
2998    */
2999   @FluentSetter
3000   public BeanContextBuilder sortProperties() {
3001      return set(BEAN_sortProperties, true);
3002   }
3003
3004   /**
3005    * Sort bean properties.
3006    *
3007    * <p>
3008    * Same as {@link #sortProperties()} but allows you to specify individual bean classes instead of globally.
3009    *
3010    * <h5 class='section'>Example:</h5>
3011    * <p class='bcode w800'>
3012    *    <jc>// A bean with 3 properties.</jc>
3013    *    <jk>public class</jk> MyBean {
3014    *       <jk>public</jk> String <jf>c</jf> = <js>"1"</js>;
3015    *       <jk>public</jk> String <jf>b</jf> = <js>"2"</js>;
3016    *       <jk>public</jk> String <jf>a</jf> = <js>"3"</js>;
3017    *    }
3018    *
3019    *    <jc>// Create a serializer that sorts properties on MyBean.</jc>
3020    *    WriterSerializer s = JsonSerializer
3021    *       .<jsm>create</jsm>()
3022    *       .sortProperties(MyBean.<jk>class</jk>)
3023    *       .build();
3024    *
3025    *    <jc>// Produces:  {"a":"3","b":"2","c":"1"}</jc>
3026    *    String json = s.serialize(<jk>new</jk> MyBean());
3027    * </p>
3028    *
3029    * <ul class='seealso'>
3030    *    <li class='ja'>{@link Bean#sort() Bean(sort)}
3031    *    <li class='jf'>{@link BeanContext#BEAN_sortProperties}
3032    * </ul>
3033    *
3034    * @param on The bean classes to sort properties on.
3035    * @return This object (for method chaining).
3036    */
3037   @FluentSetter
3038   public BeanContextBuilder sortProperties(Class<?>...on) {
3039      for (Class<?> c : on)
3040         prependTo(BEAN_annotations, new BeanAnnotation(c).sort(true));
3041      return this;
3042   }
3043
3044   /**
3045    * Identifies a stop class for the annotated class.
3046    *
3047    * <p>
3048    * Identical in purpose to the stop class specified by {@link Introspector#getBeanInfo(Class, Class)}.
3049    * Any properties in the stop class or in its base classes will be ignored during analysis.
3050    *
3051    * <p>
3052    * For example, in the following class hierarchy, instances of <c>C3</c> will include property <c>p3</c>,
3053    * but not <c>p1</c> or <c>p2</c>.
3054    *
3055    * <h5 class='section'>Example:</h5>
3056    * <p class='bcode w800'>
3057    *    <jk>public class</jk> C1 {
3058    *       <jk>public int</jk> getP1();
3059    *    }
3060    *
3061    *    <jk>public class</jk> C2 <jk>extends</jk> C1 {
3062    *       <jk>public int</jk> getP2();
3063    *    }
3064    *
3065    *    <jk>public class</jk> C3 <jk>extends</jk> C2 {
3066    *       <jk>public int</jk> getP3();
3067    *    }
3068    *
3069    *    <jc>// Create a serializer specifies a stop class for C3.</jc>
3070    *    WriterSerializer s = JsonSerializer
3071    *       .<jsm>create</jsm>()
3072    *       .stopClass(C3.<jk>class</jk>, C2.<jk>class</jk>)
3073    *       .build();
3074    *
3075    *    <jc>// Produces:  {"p3":"..."}</jc>
3076    *    String json = s.serialize(<jk>new</jk> C3());
3077    * </p>
3078    *
3079    * @param on The class on which the stop class is being applied.
3080    * @param value
3081    *    The new value for this property.
3082    * @return This object (for method chaining).
3083    */
3084   @FluentSetter
3085   public BeanContextBuilder stopClass(Class<?> on, Class<?> value) {
3086      return prependTo(BEAN_annotations, new BeanAnnotation(on).stopClass(value));
3087   }
3088
3089   /**
3090    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Java object swaps.
3091    *
3092    * <p>
3093    * Swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization,
3094    * and "swap in" the non-serializable class during parsing.
3095    *
3096    * <p>
3097    * An example of a swap would be a <c>Calendar</c> object that gets swapped out for an ISO8601 string.
3098    *
3099    * <p>
3100    * Multiple swaps can be associated with a single class.
3101    * When multiple swaps are applicable to the same class, the media type pattern defined by
3102    * {@link PojoSwap#forMediaTypes()} or {@link Swap#mediaTypes() @Swap(mediaTypes)} are used to come up with the best match.
3103    *
3104    * <p>
3105    * Values can consist of any of the following types:
3106    * <ul>
3107    *    <li>Any subclass of {@link PojoSwap}.
3108    *    <li>Any instance of {@link PojoSwap}.
3109    *    <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
3110    *    <li>Any array or collection of the objects above.
3111    * </ul>
3112    *
3113    * <h5 class='section'>Example:</h5>
3114    * <p class='bcode w800'>
3115    *    <jc>// Sample swap for converting Dates to ISO8601 strings.</jc>
3116    *    <jk>public class</jk> MyDateSwap <jk>extends</jk> StringSwap&lt;Date&gt; {
3117    *       <jc>// ISO8601 formatter.</jc>
3118    *       <jk>private</jk> DateFormat <jf>format</jf> = <jk>new</jk> SimpleDateFormat(<js>"yyyy-MM-dd'T'HH:mm:ssZ"</js>);
3119    *
3120    *       <ja>@Override</ja>
3121    *       <jk>public</jk> String swap(BeanSession session, Date o) {
3122    *          <jk>return</jk> <jf>format</jf>.format(o);
3123    *       }
3124    *
3125    *       <ja>@Override</ja>
3126    *       <jk>public</jk> Date unswap(BeanSession session, String o, ClassMeta hint) <jk>throws</jk> Exception {
3127    *          <jk>return</jk> <jf>format</jf>.parse(o);
3128    *       }
3129    *    }
3130    *
3131    *    <jc>// Sample bean with a Date field.</jc>
3132    *    <jk>public class</jk> MyBean {
3133    *       <jk>public</jk> Date <jf>date</jf> = <jk>new</jk> Date(112, 2, 3, 4, 5, 6);
3134    *    }
3135    *
3136    *    <jc>// Create a serializer that uses our date swap.</jc>
3137    *    WriterSerializer s = JsonSerializer
3138    *       .<jsm>create</jsm>()
3139    *       .swaps(MyDateSwap.<jk>class</jk>)
3140    *       .build();
3141    *
3142    *    <jc>// Same, but use property.</jc>
3143    *    WriterSerializer s = JsonSerializer
3144    *       .<jsm>create</jsm>()
3145    *       .addTo(<jsf>BEAN_swaps</jsf>, MyDateSwap.<jk>class</jk>)
3146    *       .build();
3147    *
3148    *    <jc>// Produces:  {"date":"2012-03-03T04:05:06-0500"}</jc>
3149    *    String json = s.serialize(<jk>new</jk> MyBean());
3150    *
3151    *    <jc>// Create a serializer that uses our date swap.</jc>
3152    *    ReaderParser p = JsonParser
3153    *       .<jsm>create</jsm>()
3154    *       .swaps(MyDateSwap.<jk>class</jk>)
3155    *       .build();
3156    *
3157    *    <jc>// Use our parser to parse a bean.</jc>
3158    *    MyBean bean = p.parse(json, MyBean.<jk>class</jk>);
3159    * </p>
3160    *
3161    * <ul class='notes'>
3162    *    <li>The {@link Swap @Swap} annotation can also be used on classes to identify swaps for the class.
3163    *    <li>The {@link Swap @Swap} annotation can also be used on bean methods and fields to identify swaps for values of those bean properties.
3164    * </ul>
3165    *
3166    * <ul class='seealso'>
3167    *    <li class='jf'>{@link BeanContext#BEAN_swaps}
3168    * </ul>
3169    *
3170    * @param values
3171    *    The values to add to this property.
3172    *    <br>Values can consist of any of the following types:
3173    *    <ul>
3174    *       <li>Any subclass of {@link PojoSwap}.
3175    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
3176    *       <li>Any array or collection of the objects above.
3177    *    </ul>
3178    * @return This object (for method chaining).
3179    */
3180   @FluentSetter
3181   public BeanContextBuilder swaps(Object...values) {
3182      return appendTo(BEAN_swaps, values);
3183   }
3184
3185   /**
3186    * An identifying name for this class.
3187    *
3188    * <p>
3189    * The name is used to identify the class type during parsing when it cannot be inferred through reflection.
3190    * For example, if a bean property is of type <c>Object</c>, then the serializer will add the name to the
3191    * output so that the class can be determined during parsing.
3192    *
3193    * <p>
3194    * It is also used to specify element names in XML.
3195    *
3196    * <h5 class='section'>Example:</h5>
3197    * <p class='bcode w800'>
3198    *    <jc>// Use _type='mybean' to identify this bean.</jc>
3199    *    <jk>public class</jk> MyBean {...}
3200    *
3201    *    <jc>// Create a serializer and specify the type name..</jc>
3202    *    WriterSerializer s = JsonSerializer
3203    *       .<jsm>create</jsm>()
3204    *       .typeName(MyBean.<jk>class</jk>, <js>"mybean"</js>)
3205    *       .build();
3206    *
3207    *       <jc>// Produces:  {"_type":"mybean",...}</jc>
3208    *       String json = s.serialize(<jk>new</jk> MyBean());
3209    * </p>
3210    *
3211    * <ul class='notes'>
3212    *    <li>Equivalent to the {@link Bean#typeName() Bean(typeName)} annotation.
3213    * </ul>
3214    *
3215    * <ul class='seealso'>
3216    *    <li class='jc'>{@link Bean#typeName() Bean(typeName)}
3217    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
3218    * </ul>
3219    *
3220    * @param on
3221    *    The class the type name is being defined on.
3222    * @param value
3223    *    The new value for this property.
3224    * @return This object (for method chaining).
3225    */
3226   @FluentSetter
3227   public BeanContextBuilder typeName(Class<?> on, String value) {
3228      return prependTo(BEAN_annotations, new BeanAnnotation(on).typeName(value));
3229   }
3230
3231   /**
3232    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean type property name.
3233    *
3234    * <p>
3235    * This specifies the name of the bean property used to store the dictionary name of a bean type so that the
3236    * parser knows the data type to reconstruct.
3237    *
3238    * <h5 class='section'>Example:</h5>
3239    * <p class='bcode w800'>
3240    *    <jc>// POJOs with @Bean(name) annotations.</jc>
3241    *    <ja>@Bean</ja>(typeName=<js>"foo"</js>)
3242    *    <jk>public class</jk> Foo {...}
3243    *    <ja>@Bean</ja>(typeName=<js>"bar"</js>)
3244    *    <jk>public class</jk> Bar {...}
3245    *
3246    *    <jc>// Create a serializer that uses 't' instead of '_type' for dictionary names.</jc>
3247    *    WriterSerializer s = JsonSerializer
3248    *       .<jsm>create</jsm>()
3249    *       .typePropertyName(<js>"t"</js>)
3250    *       .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>)
3251    *       .build();
3252    *
3253    *    <jc>// Same, but use property.</jc>
3254    *    WriterSerializer s = JsonSerializer
3255    *       .<jsm>create</jsm>()
3256    *       .set(<jsf>BEAN_typePropertyName</jsf>, <js>"t"</js>)
3257    *       .addTo(<jsf>BEAN_beanDictionary</jsf>, Foo.<jk>class</jk>)
3258    *       .addTo(<jsf>BEAN_beanDictionary</jsf>, Bar.<jk>class</jk>)
3259    *       .build();
3260    *
3261    *    <jc>// A bean with a field with an indeterminate type.</jc>
3262    *    <jk>public class</jk> MyBean {
3263    *       <jk>public</jk> Object <jf>mySimpleField</jf>;
3264    *    }
3265    *
3266    *    <jc>// Parse bean.</jc>
3267    *    MyBean b = p.parse(<js>"{mySimpleField:{t:'foo',...}}"</js>, MyBean.<jk>class</jk>);
3268    * </p>
3269    *
3270    * <ul class='seealso'>
3271    *    <li class='jf'>{@link BeanContext#BEAN_typePropertyName}
3272    * </ul>
3273    *
3274    * @param value
3275    *    The new value for this property.
3276    *    <br>The default is <js>"_type"</js>.
3277    * @return This object (for method chaining).
3278    */
3279   @FluentSetter
3280   public BeanContextBuilder typePropertyName(String value) {
3281      return set(BEAN_typePropertyName, value);
3282   }
3283
3284   /**
3285    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Bean type property name.
3286    *
3287    * <p>
3288    * Same as {@link #typePropertyName(String)} except targets a specific bean class instead of globally.
3289    *
3290    * <h5 class='section'>Example:</h5>
3291    * <p class='bcode w800'>
3292    *    <jc>// POJOs with @Bean(name) annotations.</jc>
3293    *    <ja>@Bean</ja>(typeName=<js>"foo"</js>)
3294    *    <jk>public class</jk> Foo {...}
3295    *    <ja>@Bean</ja>(typeName=<js>"bar"</js>)
3296    *    <jk>public class</jk> Bar {...}
3297    *
3298    *    <jc>// A bean with a field with an indeterminate type.</jc>
3299    *    <jk>public class</jk> MyBean {
3300    *       <jk>public</jk> Object <jf>mySimpleField</jf>;
3301    *    }
3302    *
3303    *    <jc>// Create a serializer that uses 't' instead of '_type' for dictionary names.</jc>
3304    *    WriterSerializer s = JsonSerializer
3305    *       .<jsm>create</jsm>()
3306    *       .typePropertyName(MyBean.<jk>class</jk>, <js>"t"</js>)
3307    *       .dictionary(Foo.<jk>class</jk>, Bar.<jk>class</jk>)
3308    *       .build();
3309    *
3310    *    <jc>// Parse bean.</jc>
3311    *    MyBean b = p.parse(<js>"{mySimpleField:{t:'foo',...}}"</js>, MyBean.<jk>class</jk>);
3312    * </p>
3313    *
3314    * <ul class='seealso'>
3315    *    <li class='ja'>{@link Bean#typePropertyName() Bean(typePropertyName)}
3316    *    <li class='jf'>{@link BeanContext#BEAN_typePropertyName}
3317    * </ul>
3318    *
3319    * @param on The class the type property name applies to.
3320    * @param value
3321    *    The new value for this property.
3322    *    <br>The default is <js>"_type"</js>.
3323    * @return This object (for method chaining).
3324    */
3325   @FluentSetter
3326   public BeanContextBuilder typePropertyName(Class<?> on, String value) {
3327      return prependTo(BEAN_annotations, new BeanAnnotation(on).typePropertyName(value));
3328   }
3329
3330   /**
3331    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use enum names.
3332    *
3333    * <div class='warn'>
3334    *    <b>Deprecated</b> - Use {@link #useEnumNames()}
3335    * </div>
3336    */
3337   @SuppressWarnings("javadoc")
3338   @Deprecated
3339   @FluentSetter
3340   public BeanContextBuilder useEnumNames(boolean value) {
3341      return set(BEAN_useEnumNames, value);
3342   }
3343
3344   /**
3345    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use enum names.
3346    *
3347    * <p>
3348    * When enabled, enums are always serialized by name, not using {@link Object#toString()}.
3349    *
3350    * <h5 class='section'>Example:</h5>
3351    * <p class='bcode w800'>
3352    *    <jc>// Create a serializer with debug enabled.</jc>
3353    *    WriterSerializer s = JsonSerializer
3354    *       .<jsm>create</jsm>()
3355    *       .useEnumNames()
3356    *       .build();
3357    *
3358    *    <jc>// Same, but use property.</jc>
3359    *    WriterSerializer s = JsonSerializer
3360    *       .<jsm>create</jsm>()
3361    *       .set(<jsf>BEAN_useEnumNames</jsf>, <jk>true</jk>)
3362    *       .build();
3363    *
3364    *    <jc>// Enum with overridden toString().</jc>
3365    *    <jc>// Will be serialized as ONE/TWO/THREE even though there's a toString() method.</jc>
3366    *    <jk>public enum</jk> Option {
3367    *       <jsf>ONE</jsf>(1),
3368    *       <jsf>TWO</jsf>(2),
3369    *       <jsf>THREE</jsf>(3);
3370    *
3371    *       <jk>private int</jk> <jf>i</jf>;
3372    *
3373    *       Option(<jk>int</jk> i) {
3374    *          <jk>this</jk>.<jf>i</jf> = i;
3375    *       }
3376    *
3377    *       <ja>@Override</ja>
3378    *       <jk>public</jk> String toString() {
3379    *          <jk>return</jk> String.<jsm>valueOf</jsm>(<jf>i</jf>);
3380    *       }
3381    *    }
3382    * </p>
3383    *
3384    * <ul class='seealso'>
3385    *    <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
3386    * </ul>
3387    *
3388    * @return This object (for method chaining).
3389    */
3390   @FluentSetter
3391   public BeanContextBuilder useEnumNames() {
3392      return set(BEAN_useEnumNames, true);
3393   }
3394
3395   /**
3396    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use interface proxies.
3397    *
3398    * <div class='warn'>
3399    *    <b>Deprecated</b> - Use {@link #dontUseInterfaceProxies()}
3400    * </div>
3401    */
3402   @SuppressWarnings("javadoc")
3403   @Deprecated
3404   @FluentSetter
3405   public BeanContextBuilder useInterfaceProxies(boolean value) {
3406      return set(BEAN_useInterfaceProxies, value);
3407   }
3408
3409   /**
3410    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use interface proxies.
3411    *
3412    * <p>
3413    * When enabled, interfaces will be instantiated as proxy classes through the use of an
3414    * {@link InvocationHandler} if there is no other way of instantiating them.
3415    * Otherwise, throws a {@link BeanRuntimeException}.
3416    *
3417    * <h5 class='section'>Example:</h5>
3418    * <p class='bcode w800'>
3419    *    <jc>// An interface with a single getter.</jc>
3420    *    <jk>public interface</jk> MyBean {
3421    *       String getFoo();
3422    *       <jk>void</jk> setFoo(String foo);
3423    *    }
3424    *
3425    *    <jc>// Create a parser that uses interface proxies.</jc>
3426    *    ReaderParser p = JsonParser
3427    *       .<jsm>create</jsm>()
3428    *       .build();
3429    *
3430    *    <jc>// Same, but use property.</jc>
3431    *    ReaderParser p = JsonParser
3432    *       .<jsm>create</jsm>()
3433    *       .set(<jsf>BEAN_useInterfaceProxies</jsf>, <jk>true</jk>)
3434    *       .build();
3435    *
3436    *    <jc>// Creates a proxy implementation of a MyBean interface.</jc>
3437    *    MyBean b = p.parse(<js>"{foo:'bar'}"</js>, MyBean.<jk>class</jk>);
3438    * </p>
3439    *
3440    * <ul class='seealso'>
3441    *    <li class='jf'>{@link BeanContext#BEAN_useInterfaceProxies}
3442    * </ul>
3443    *
3444    * @return This object (for method chaining).
3445    */
3446   @FluentSetter
3447   public BeanContextBuilder dontUseInterfaceProxies() {
3448      return set(BEAN_useInterfaceProxies, false);
3449   }
3450
3451   /**
3452    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use Java Introspector.
3453    *
3454    * <div class='warn'>
3455    *    <b>Deprecated</b> - Use {@link #useJavaBeanIntrospector()}
3456    * </div>
3457    */
3458   @SuppressWarnings("javadoc")
3459   @Deprecated
3460   @FluentSetter
3461   public BeanContextBuilder useJavaBeanIntrospector(boolean value) {
3462      return set(BEAN_useJavaBeanIntrospector, value);
3463   }
3464
3465   /**
3466    * <i><l>BeanContext</l> configuration property:&emsp;</i>  Use Java Introspector.
3467    *
3468    * <p>
3469    * Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
3470    * <br>Most {@link Bean @Bean} annotations will be ignored.
3471    *
3472    * <h5 class='section'>Example:</h5>
3473    * <p class='bcode w800'>
3474    *    <jc>// Create a serializer that only uses the built-in java bean introspector for finding properties.</jc>
3475    *    WriterSerializer s = JsonSerializer
3476    *       .<jsm>create</jsm>()
3477    *       .useJavaBeanIntrospector()
3478    *       .build();
3479    *
3480    *    <jc>// Same, but use property.</jc>
3481    *    WriterSerializer s = JsonSerializer
3482    *       .<jsm>create</jsm>()
3483    *       .set(<jsf>BEAN_useJavaBeanIntrospector</jsf>, <jk>true</jk>)
3484    *       .build();
3485    * </p>
3486    *
3487    * <ul class='seealso'>
3488    *    <li class='jf'>{@link BeanContext#BEAN_useJavaBeanIntrospector}
3489    * </ul>
3490    *
3491    * @return This object (for method chaining).
3492    */
3493   @FluentSetter
3494   public BeanContextBuilder useJavaBeanIntrospector() {
3495      return set(BEAN_useJavaBeanIntrospector, true);
3496   }
3497
3498   // <FluentSetters>
3499
3500   @Override /* GENERATED - ContextBuilder */
3501   public BeanContextBuilder add(Map<String,Object> properties) {
3502      super.add(properties);
3503      return this;
3504   }
3505
3506   @Override /* GENERATED - ContextBuilder */
3507   public BeanContextBuilder addTo(String name, Object value) {
3508      super.addTo(name, value);
3509      return this;
3510   }
3511
3512   @Override /* GENERATED - ContextBuilder */
3513   public BeanContextBuilder appendTo(String name, Object value) {
3514      super.appendTo(name, value);
3515      return this;
3516   }
3517
3518   @Override /* GENERATED - ContextBuilder */
3519   public BeanContextBuilder apply(PropertyStore copyFrom) {
3520      super.apply(copyFrom);
3521      return this;
3522   }
3523
3524   @Override /* GENERATED - ContextBuilder */
3525   public BeanContextBuilder applyAnnotations(java.lang.Class<?>...fromClasses) {
3526      super.applyAnnotations(fromClasses);
3527      return this;
3528   }
3529
3530   @Override /* GENERATED - ContextBuilder */
3531   public BeanContextBuilder applyAnnotations(Method...fromMethods) {
3532      super.applyAnnotations(fromMethods);
3533      return this;
3534   }
3535
3536   @Override /* GENERATED - ContextBuilder */
3537   public BeanContextBuilder applyAnnotations(AnnotationList al, VarResolverSession r) {
3538      super.applyAnnotations(al, r);
3539      return this;
3540   }
3541
3542   @Override /* GENERATED - ContextBuilder */
3543   public BeanContextBuilder debug() {
3544      super.debug();
3545      return this;
3546   }
3547
3548   @Override /* GENERATED - ContextBuilder */
3549   public BeanContextBuilder locale(Locale value) {
3550      super.locale(value);
3551      return this;
3552   }
3553
3554   @Override /* GENERATED - ContextBuilder */
3555   public BeanContextBuilder mediaType(MediaType value) {
3556      super.mediaType(value);
3557      return this;
3558   }
3559
3560   @Override /* GENERATED - ContextBuilder */
3561   public BeanContextBuilder prependTo(String name, Object value) {
3562      super.prependTo(name, value);
3563      return this;
3564   }
3565
3566   @Override /* GENERATED - ContextBuilder */
3567   public BeanContextBuilder putAllTo(String name, Object value) {
3568      super.putAllTo(name, value);
3569      return this;
3570   }
3571
3572   @Override /* GENERATED - ContextBuilder */
3573   public BeanContextBuilder putTo(String name, String key, Object value) {
3574      super.putTo(name, key, value);
3575      return this;
3576   }
3577
3578   @Override /* GENERATED - ContextBuilder */
3579   public BeanContextBuilder removeFrom(String name, Object value) {
3580      super.removeFrom(name, value);
3581      return this;
3582   }
3583
3584   @Override /* GENERATED - ContextBuilder */
3585   public BeanContextBuilder set(Map<String,Object> properties) {
3586      super.set(properties);
3587      return this;
3588   }
3589
3590   @Override /* GENERATED - ContextBuilder */
3591   public BeanContextBuilder set(String name, Object value) {
3592      super.set(name, value);
3593      return this;
3594   }
3595
3596   @Override /* GENERATED - ContextBuilder */
3597   public BeanContextBuilder timeZone(TimeZone value) {
3598      super.timeZone(value);
3599      return this;
3600   }
3601
3602   // </FluentSetters>
3603}