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.io.*;
019import java.lang.annotation.*;
020import java.lang.reflect.*;
021import java.util.*;
022
023import org.apache.juneau.annotation.*;
024import org.apache.juneau.http.*;
025import org.apache.juneau.marshall.*;
026import org.apache.juneau.parser.*;
027import org.apache.juneau.reflect.*;
028import org.apache.juneau.serializer.*;
029import org.apache.juneau.svl.*;
030import org.apache.juneau.transform.*;
031
032/**
033 * Builder class for building instances of serializers, parsers, and bean contexts.
034 *
035 * <p>
036 * All serializers and parsers extend from this class.
037 *
038 * <p>
039 * Provides a base set of common config property setters that allow you to build up serializers and parsers.
040 *
041 * <p class='bcode w800'>
042 *    WriterSerializer s = JsonSerializer
043 *       .<jsm>create</jsm>()
044 *       .set(<jsf>JSON_simpleMode</jsf>, <jk>true</jk>)
045 *       .set(<jsf>SERIALIZER_useWhitespace</jsf>, <jk>true</jk>)
046 *       .set(<jsf>SERIALIZER_quoteChar</jsf>, <js>"'"</js>)
047 *       .build();
048 * </p>
049 *
050 * <p>
051 * Additional convenience methods are provided for setting properties using reduced syntax.
052 *
053 * <p class='bcode w800'>
054 *    WriterSerializer s = JsonSerializer
055 *       .<jsm>create</jsm>()  <jc>// Create a JsonSerializerBuilder</jc>
056 *       .simple()  <jc>// Simple mode</jc>
057 *       .ws()  <jc>// Use whitespace</jc>
058 *       .sq()  <jc>// Use single quotes </jc>
059 *       .build();  <jc>// Create a JsonSerializer</jc>
060 * </p>
061 *
062 * <ul class='seealso'>
063 *    <li class='link'>{@doc juneau-marshall.ConfigurableProperties}
064 * </ul>
065 */
066public class BeanContextBuilder extends ContextBuilder {
067
068   /**
069    * Constructor.
070    *
071    * All default settings.
072    */
073   public BeanContextBuilder() {
074      super();
075   }
076
077   /**
078    * Constructor.
079    *
080    * @param ps The initial configuration settings for this builder.
081    */
082   public BeanContextBuilder(PropertyStore ps) {
083      super(ps);
084   }
085
086   @Override /* ContextBuilder */
087   public BeanContext build() {
088      return build(BeanContext.class);
089   }
090
091   //-----------------------------------------------------------------------------------------------------------------
092   // Properties
093   //-----------------------------------------------------------------------------------------------------------------
094
095   /**
096    * Configuration property:  Annotations.
097    *
098    * <p>
099    * Defines annotations to apply to specific classes and methods.
100    *
101    * <p>
102    * Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods.
103    * Useful in cases where you want to use the functionality of the annotation on beans and bean properties but
104    * do not have access to the code to do so.
105    *
106    * <ul class='seealso'>
107    *    <li class='jf'>{@link BeanContext#BEAN_annotations}
108    * </ul>
109    *
110    * @param values
111    *    The values to add to this property.
112    * @return This object (for method chaining).
113    */
114   public BeanContextBuilder annotations(Annotation...values) {
115      return addTo(BEAN_annotations, values);
116   }
117
118   /**
119    * Configuration property:  Minimum bean class visibility.
120    *
121    * <p>
122    * Classes are not considered beans unless they meet the minimum visibility requirements.
123    *
124    * <p>
125    * For example, if the visibility is <c>PUBLIC</c> and the bean class is <jk>protected</jk>, then the class
126    * will not be interpreted as a bean class and will be treated as a string.
127    *
128    * <ul class='seealso'>
129    *    <li class='jf'>{@link BeanContext#BEAN_beanClassVisibility}
130    * </ul>
131    *
132    * @param value
133    *    The new value for this property.
134    *    <br>The default is {@link Visibility#PUBLIC}.
135    * @return This object (for method chaining).
136    */
137   public BeanContextBuilder beanClassVisibility(Visibility value) {
138      return set(BEAN_beanClassVisibility, value);
139   }
140
141   /**
142    * Configuration property:  Minimum bean constructor visibility.
143    *
144    * <p>
145    * Only look for constructors with the specified minimum visibility.
146    *
147    * <ul class='seealso'>
148    *    <li class='jf'>{@link BeanContext#BEAN_beanConstructorVisibility}
149    * </ul>
150    *
151    * @param value
152    *    The new value for this property.
153    *    <br>The default is {@link Visibility#PUBLIC}.
154    * @return This object (for method chaining).
155    */
156   public BeanContextBuilder beanConstructorVisibility(Visibility value) {
157      return set(BEAN_beanConstructorVisibility, value);
158   }
159
160   /**
161    * Configuration property:  Bean dictionary.
162    *
163    * <div class='warn'>
164    *    <b>Deprecated</b> - Use {@link #dictionary(Object...)}
165    * </div>
166    *
167    * <p>
168    * Adds to the list of classes that make up the bean dictionary in this bean context.
169    *
170    * <ul class='seealso'>
171    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
172    * </ul>
173    *
174    * @param values
175    *    The values to add to this property.
176    * @return This object (for method chaining).
177    */
178   @Deprecated
179   public BeanContextBuilder beanDictionary(Object...values) {
180      return addTo(BEAN_beanDictionary, values);
181   }
182
183   /**
184    * Configuration property:  Bean dictionary.
185    *
186    * <div class='warn'>
187    *    <b>Deprecated</b> - Use {@link #dictionary(Class...)}
188    * </div>
189    *
190    * <p>
191    * Same as {@link #beanDictionary(Object...)} but takes in an array of classes.
192    *
193    * <ul class='seealso'>
194    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
195    * </ul>
196    *
197    * @param values
198    *    The values to add to this property.
199    * @return This object (for method chaining).
200    */
201   @Deprecated
202   public BeanContextBuilder beanDictionary(Class<?>...values) {
203      return addTo(BEAN_beanDictionary, values);
204   }
205
206   /**
207    * Configuration property:  Bean dictionary.
208    *
209    * <div class='warn'>
210    *    <b>Deprecated</b> - Use {@link #dictionaryReplace(Class...)}
211    * </div>
212    *
213    * <p>
214    * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
215    *
216    * <ul class='seealso'>
217    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
218    * </ul>
219    *
220    * @param values
221    *    The new values for this property.
222    * @return This object (for method chaining).
223    */
224   @Deprecated
225   public BeanContextBuilder beanDictionaryReplace(Class<?>...values) {
226      return set(BEAN_beanDictionary, values);
227   }
228
229   /**
230    * Configuration property:  Bean dictionary.
231    *
232    * <div class='warn'>
233    *    <b>Deprecated</b> - Use {@link #dictionaryReplace(Object...)}
234    * </div>
235    *
236    * <p>
237    * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
238    *
239    * <ul class='seealso'>
240    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
241    * </ul>
242    *
243    * @param values
244    *    The new values for this property.
245    * @return This object (for method chaining).
246    */
247   @Deprecated
248   public BeanContextBuilder beanDictionaryReplace(Object...values) {
249      return set(BEAN_beanDictionary, values);
250   }
251
252   /**
253    * Configuration property:  Bean dictionary.
254    *
255    * <div class='warn'>
256    *    <b>Deprecated</b> - Use {@link #dictionaryRemove(Class...)}
257    * </div>
258    *
259    * <p>
260    * Removes from the list of classes that make up the bean dictionary in this bean context.
261    *
262    * <ul class='seealso'>
263    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
264    * </ul>
265    *
266    * @param values
267    *    The values to remove from this property.
268    * @return This object (for method chaining).
269    */
270   @Deprecated
271   public BeanContextBuilder beanDictionaryRemove(Class<?>...values) {
272      return removeFrom(BEAN_beanDictionary, values);
273   }
274
275   /**
276    * Configuration property:  Bean dictionary.
277    *
278    * <div class='warn'>
279    *    <b>Deprecated</b> - Use {@link #dictionaryRemove(Object...)}
280    * </div>
281    *
282    * <p>
283    * Removes from the list of classes that make up the bean dictionary in this bean context.
284    *
285    * <ul class='seealso'>
286    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
287    * </ul>
288    *
289    * @param values
290    *    The values to remove from this property.
291    * @return This object (for method chaining).
292    */
293   @Deprecated
294   public BeanContextBuilder beanDictionaryRemove(Object...values) {
295      return removeFrom(BEAN_beanDictionary, values);
296   }
297
298   /**
299    * Configuration property:  Minimum bean field visibility.
300    *
301    * <p>
302    * Only look for bean fields with the specified minimum visibility.
303    *
304    * <ul class='seealso'>
305    *    <li class='jf'>{@link BeanContext#BEAN_beanFieldVisibility}
306    * </ul>
307    *
308    * @param value
309    *    The new value for this property.
310    *    <br>The default is {@link Visibility#PUBLIC}.
311    * @return This object (for method chaining).
312    */
313   public BeanContextBuilder beanFieldVisibility(Visibility value) {
314      return set(BEAN_beanFieldVisibility, value);
315   }
316
317   /**
318    * Configuration property:  Bean filters.
319    *
320    * <p>
321    * This is a programmatic equivalent to the {@link Bean @Bean} annotation.
322    * <br>It's useful when you want to use the Bean annotation functionality, but you don't have the ability to alter
323    * the bean classes.
324    *
325    * <ul class='seealso'>
326    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
327    * </ul>
328    *
329    * @param values
330    *    The values to add to this property.
331    *    <br>Values can consist of any of the following types:
332    *    <ul>
333    *       <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
334    *       <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
335    *       <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
336    *       <li>Any array or collection of the objects above.
337    *    </ul>
338    * @return This object (for method chaining).
339    */
340   public BeanContextBuilder beanFilters(Object...values) {
341      return addTo(BEAN_beanFilters, values);
342   }
343
344   /**
345    * Configuration property:  Bean filters.
346    *
347    * <p>
348    * Same as {@link #beanFilters(Object...)} but takes in an array of classes.
349    *
350    * <ul class='seealso'>
351    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
352    * </ul>
353    *
354    * @param values
355    *    The values to add to this property.
356    * @return This object (for method chaining).
357    */
358   public BeanContextBuilder beanFilters(Class<?>...values) {
359      return addTo(BEAN_beanFilters, values);
360   }
361
362   /**
363    * Configuration property:  Bean filters.
364    *
365    * <p>
366    * Same as {@link #beanFilters(Object...)} but replaces the existing values.
367    *
368    * <ul class='seealso'>
369    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
370    * </ul>
371    *
372    * @param values
373    *    The new values for this property.
374    *    <br>Values can consist of any of the following types:
375    *    <ul>
376    *       <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
377    *       <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
378    *       <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
379    *    </ul>
380    * @return This object (for method chaining).
381    */
382   public BeanContextBuilder beanFiltersReplace(Class<?>...values) {
383      return set(BEAN_beanFilters, values);
384   }
385
386   /**
387    * Configuration property:  Bean filters.
388    *
389    * <p>
390    * Same as {@link #beanFilters(Object...)} but replaces the existing values.
391    *
392    * <ul class='seealso'>
393    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
394    * </ul>
395    *
396    * @param values
397    *    The new values for this property.
398    *    <br>Values can consist of any of the following types:
399    *    <ul>
400    *       <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
401    *       <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
402    *       <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
403    *       <li>Any array or collection of the objects above.
404    *    </ul>
405    * @return This object (for method chaining).
406    */
407   public BeanContextBuilder beanFiltersReplace(Object...values) {
408      return set(BEAN_beanFilters, values);
409   }
410
411   /**
412    * Configuration property:  Bean filters.
413    *
414    * <p>
415    * Removes from the list of classes that make up the bean filters in this bean context.
416    *
417    * <ul class='seealso'>
418    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
419    * </ul>
420    *
421    * @param values
422    *    The values to remove from this property.
423    *    <br>Values can consist of any of the following types:
424    *    <ul>
425    *       <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
426    *       <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
427    *       <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
428    *    </ul>
429    * @return This object (for method chaining).
430    */
431   public BeanContextBuilder beanFiltersRemove(Class<?>...values) {
432      return removeFrom(BEAN_beanFilters, values);
433   }
434
435   /**
436    * Configuration property:  Bean filters.
437    *
438    * <p>
439    * Removes from the list of classes that make up the bean filters in this bean context.
440    *
441    * <ul class='seealso'>
442    *    <li class='jf'>{@link BeanContext#BEAN_beanFilters}
443    * </ul>
444    *
445    * @param values
446    *    The values to remove from this property.
447    *    <br>Values can consist of any of the following types:
448    *    <ul>
449    *       <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
450    *       <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
451    *       <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
452    *       <li>Any array or collection of the objects above.
453    *    </ul>
454    * @return This object (for method chaining).
455    */
456   public BeanContextBuilder beanFiltersRemove(Object...values) {
457      return removeFrom(BEAN_beanFilters, values);
458   }
459
460   /**
461    * Configuration property:  BeanMap.put() returns old property value.
462    *
463    * <p>
464    * If <jk>true</jk>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property
465    * values.
466    * <br>Otherwise, it returns <jk>null</jk>.
467    *
468    * <ul class='seealso'>
469    *    <li class='jf'>{@link BeanContext#BEAN_beanMapPutReturnsOldValue}
470    * </ul>
471    *
472    * @param value
473    *    The new value for this property.
474    *    <br>The default is <jk>false</jk>.
475    * @return This object (for method chaining).
476    */
477   public BeanContextBuilder beanMapPutReturnsOldValue(boolean value) {
478      return set(BEAN_beanMapPutReturnsOldValue, value);
479   }
480
481   /**
482    * Configuration property:  BeanMap.put() returns old property value.
483    *
484    * <p>
485    * Shortcut for calling <code>beanMapPutReturnsOldValue(<jk>true</jk>)</code>.
486    *
487    * <ul class='seealso'>
488    *    <li class='jf'>{@link BeanContext#BEAN_beanMapPutReturnsOldValue}
489    * </ul>
490    *
491    * @return This object (for method chaining).
492    */
493   public BeanContextBuilder beanMapPutReturnsOldValue() {
494      return set(BEAN_beanMapPutReturnsOldValue, true);
495   }
496
497   /**
498    * Configuration property:  Minimum bean method visibility.
499    *
500    * <p>
501    * Only look for bean methods with the specified minimum visibility.
502    *
503    * <ul class='seealso'>
504    *    <li class='jf'>{@link BeanContext#BEAN_beanMethodVisibility}
505    * </ul>
506    *
507    * @param value
508    *    The new value for this property.
509    *    <br>The default is {@link Visibility#PUBLIC}
510    * @return This object (for method chaining).
511    */
512   public BeanContextBuilder beanMethodVisibility(Visibility value) {
513      return set(BEAN_beanMethodVisibility, value);
514   }
515
516   /**
517    * Configuration property:  Beans require no-arg constructors.
518    *
519    * <p>
520    * If <jk>true</jk>, a Java class must implement a default no-arg constructor to be considered a bean.
521    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
522    *
523    * <ul class='seealso'>
524    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireDefaultConstructor}
525    * </ul>
526    *
527    * @param value
528    *    The new value for this property.
529    *    <br>The default is <jk>false</jk>.
530    * @return This object (for method chaining).
531    */
532   public BeanContextBuilder beansRequireDefaultConstructor(boolean value) {
533      return set(BEAN_beansRequireDefaultConstructor, value);
534   }
535
536   /**
537    * Configuration property:  Beans require no-arg constructors.
538    *
539    * <p>
540    * Shortcut for calling <code>beansRequireDefaultConstructor(<jk>true</jk>)</code>.
541    *
542    * <ul class='seealso'>
543    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireDefaultConstructor}
544    * </ul>
545    *
546    * @return This object (for method chaining).
547    */
548   public BeanContextBuilder beansRequireDefaultConstructor() {
549      return set(BEAN_beansRequireDefaultConstructor, true);
550   }
551
552   /**
553    * Configuration property:  Beans require Serializable interface.
554    *
555    * <p>
556    * If <jk>true</jk>, a Java class must implement the {@link Serializable} interface to be considered a bean.
557    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
558    *
559    * <ul class='seealso'>
560    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSerializable}
561    * </ul>
562    *
563    * @param value
564    *    The new value for this property.
565    *    <br>The default is <jk>false</jk>.
566    * @return This object (for method chaining).
567    */
568   public BeanContextBuilder beansRequireSerializable(boolean value) {
569      return set(BEAN_beansRequireSerializable, value);
570   }
571
572   /**
573    * Configuration property:  Beans require Serializable interface.
574    *
575    * <p>
576    * Shortcut for calling <code>beansRequireSerializable(<jk>true</jk>)</code>.
577    *
578    * <ul class='seealso'>
579    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSerializable}
580    * </ul>
581    *
582    * @return This object (for method chaining).
583    */
584   public BeanContextBuilder beansRequireSerializable() {
585      return set(BEAN_beansRequireSerializable, true);
586   }
587
588   /**
589    * Configuration property:  Beans require setters for getters.
590    *
591    * <p>
592    * If <jk>true</jk>, only getters that have equivalent setters will be considered as properties on a bean.
593    * <br>Otherwise, they will be ignored.
594    *
595    * <ul class='seealso'>
596    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSettersForGetters}
597    * </ul>
598    *
599    * @param value
600    *    The new value for this property.
601    *    <br>The default is <jk>false</jk>.
602    * @return This object (for method chaining).
603    */
604   public BeanContextBuilder beansRequireSettersForGetters(boolean value) {
605      return set(BEAN_beansRequireSettersForGetters, value);
606   }
607
608   /**
609    * Configuration property:  Beans require setters for getters.
610    *
611    * <p>
612    * Shortcut for calling <code>beansRequireSettersForGetters(<jk>true</jk>)</code>.
613    *
614    * <ul class='seealso'>
615    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSettersForGetters}
616    * </ul>
617    *
618    * @return This object (for method chaining).
619    */
620   public BeanContextBuilder beansRequireSettersForGetters() {
621      return set(BEAN_beansRequireSettersForGetters, true);
622   }
623
624   /**
625    * Configuration property:  Beans require at least one property.
626    *
627    * <p>
628    * If <jk>true</jk>, then a Java class must contain at least 1 property to be considered a bean.
629    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
630    *
631    * <ul class='seealso'>
632    *    <li class='jf'>{@link BeanContext#BEAN_beansRequireSomeProperties}
633    * </ul>
634    *
635    * @param value
636    *    The new value for this property.
637    *    <br>The default is <jk>true</jk>.
638    * @return This object (for method chaining).
639    */
640   public BeanContextBuilder beansRequireSomeProperties(boolean value) {
641      return set(BEAN_beansRequireSomeProperties, value);
642   }
643
644   /**
645    * Configuration property:  Bean type property name.
646    *
647    * <p>
648    * This specifies the name of the bean property used to store the dictionary name of a bean type so that the
649    * parser knows the data type to reconstruct.
650    *
651    * <ul class='seealso'>
652    *    <li class='jf'>{@link BeanContext#BEAN_beanTypePropertyName}
653    * </ul>
654    *
655    * @param value
656    *    The new value for this property.
657    *    <br>The default is <js>"_type"</js>.
658    * @return This object (for method chaining).
659    */
660   public BeanContextBuilder beanTypePropertyName(String value) {
661      return set(BEAN_beanTypePropertyName, value);
662   }
663
664   /**
665    * Configuration property:  Bean property includes.
666    *
667    * <p>
668    * Specifies the set and order of names of properties associated with the bean class.
669    *
670    * <ul class='seealso'>
671    *    <li class='jf'>{@link BeanContext#BEAN_bpi}
672    * </ul>
673    *
674    * @param beanClass The bean class.
675    * @param value Comma-delimited list of property names.
676    * @return This object (for method chaining).
677    */
678   public BeanContextBuilder bpi(Class<?> beanClass, String value) {
679      return addTo(BEAN_bpi, beanClass.getName(), value);
680   }
681
682   /**
683    * Configuration property:  Bean property includes.
684    *
685    * <p>
686    * Specifies the set and order of names of properties associated with the bean class.
687    *
688    * <ul class='seealso'>
689    *    <li class='jf'>{@link BeanContext#BEAN_bpi}
690    * </ul>
691    *
692    * @param values The new value for this property.
693    * @return This object (for method chaining).
694    */
695   public BeanContextBuilder bpi(Map<String,String> values) {
696      return set(BEAN_bpi, values);
697   }
698
699   /**
700    * Configuration property:  Bean property includes.
701    *
702    * <p>
703    * Specifies the set and order of names of properties associated with the bean class.
704    *
705    * <ul class='seealso'>
706    *    <li class='jf'>{@link BeanContext#BEAN_bpi}
707    * </ul>
708    *
709    * @param beanClassName
710    *    The bean class name.
711    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all beans.
712    * @param value Comma-delimited list of property names.
713    * @return This object (for method chaining).
714    */
715   public BeanContextBuilder bpi(String beanClassName, String value) {
716      return addTo(BEAN_bpi, beanClassName, value);
717   }
718
719   /**
720    * Configuration property:  Bean property excludes.
721    *
722    * <p>
723    * Specifies to exclude the specified list of properties for the specified bean class.
724    *
725    * <ul class='seealso'>
726    *    <li class='jf'>{@link BeanContext#BEAN_bpx}
727    * </ul>
728    *
729    * @param beanClass The bean class.
730    * @param properties Comma-delimited list of property names.
731    * @return This object (for method chaining).
732    */
733   public BeanContextBuilder bpx(Class<?> beanClass, String properties) {
734      return addTo(BEAN_bpx, beanClass.getName(), properties);
735   }
736
737   /**
738    * Configuration property:  Bean property excludes.
739    *
740    * <p>
741    * Specifies to exclude the specified list of properties for the specified bean classes.
742    *
743    * <ul class='seealso'>
744    *    <li class='jf'>{@link BeanContext#BEAN_bpx}
745    * </ul>
746    *
747    * @param values
748    *    The new value for this property.
749    * @return This object (for method chaining).
750    */
751   public BeanContextBuilder bpx(Map<String,String> values) {
752      return set(BEAN_bpx, values);
753   }
754
755   /**
756    * Configuration property:  Bean property excludes.
757    *
758    * <ul class='seealso'>
759    *    <li class='jf'>{@link BeanContext#BEAN_bpx}
760    * </ul>
761    *
762    * @param beanClassName
763    *    The bean class name.
764    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
765    * @param value Comma-delimited list of property names.
766    * @return This object (for method chaining).
767    */
768   public BeanContextBuilder bpx(String beanClassName, String value) {
769      return addTo(BEAN_bpx, beanClassName, value);
770   }
771
772   /**
773    * Configuration property:  Read-only bean properties.
774    *
775    * <p>
776    * Specifies the read-only properties for the specified bean class.
777    *
778    * <ul class='seealso'>
779    *    <li class='jf'>{@link BeanContext#BEAN_bpro}
780    * </ul>
781    *
782    * @param beanClass The bean class.
783    * @param properties Comma-delimited list of property names.
784    * @return This object (for method chaining).
785    */
786   public BeanContextBuilder bpro(Class<?> beanClass, String properties) {
787      return addTo(BEAN_bpro, beanClass.getName(), properties);
788   }
789
790   /**
791    * Configuration property:  Read-only bean properties.
792    *
793    * <p>
794    * Specifies the read-only properties for the specified bean classes.
795    *
796    * <ul class='seealso'>
797    *    <li class='jf'>{@link BeanContext#BEAN_bpro}
798    * </ul>
799    *
800    * @param values
801    *    The new value for this property.
802    * @return This object (for method chaining).
803    */
804   public BeanContextBuilder bpro(Map<String,String> values) {
805      return set(BEAN_bpro, values);
806   }
807
808   /**
809    * Configuration property:  Read-only bean properties.
810    *
811    * <p>
812    * Specifies the read-only properties for the specified bean class.
813    *
814    * <ul class='seealso'>
815    *    <li class='jf'>{@link BeanContext#BEAN_bpro}
816    * </ul>
817    *
818    * @param beanClassName
819    *    The bean class name.
820    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
821    * @param value Comma-delimited list of property names.
822    * @return This object (for method chaining).
823    */
824   public BeanContextBuilder bpro(String beanClassName, String value) {
825      return addTo(BEAN_bpro, beanClassName, value);
826   }
827
828   /**
829    * Configuration property:  Write-only bean properties.
830    *
831    * <p>
832    * Specifies the write-only properties for the specified bean class.
833    *
834    * <ul class='seealso'>
835    *    <li class='jf'>{@link BeanContext#BEAN_bpwo}
836    * </ul>
837    *
838    * @param beanClass The bean class.
839    * @param properties Comma-delimited list of property names.
840    * @return This object (for method chaining).
841    */
842   public BeanContextBuilder bpwo(Class<?> beanClass, String properties) {
843      return addTo(BEAN_bpwo, beanClass.getName(), properties);
844   }
845
846   /**
847    * Configuration property:  Write-only bean properties.
848    *
849    * <p>
850    * Specifies the write-only properties for the specified bean classes.
851    *
852    * <ul class='seealso'>
853    *    <li class='jf'>{@link BeanContext#BEAN_bpwo}
854    * </ul>
855    *
856    * @param values
857    *    The new value for this property.
858    * @return This object (for method chaining).
859    */
860   public BeanContextBuilder bpwo(Map<String,String> values) {
861      return set(BEAN_bpwo, values);
862   }
863
864   /**
865    * Configuration property:  Write-only bean properties.
866    *
867    * <p>
868    * Specifies the write-only properties for the specified bean class.
869    *
870    * <ul class='seealso'>
871    *    <li class='jf'>{@link BeanContext#BEAN_bpwo}
872    * </ul>
873    *
874    * @param beanClassName
875    *    The bean class name.
876    *    <br>Can be a simple name, fully-qualified name, or <js>"*"</js> for all bean classes.
877    * @param value Comma-delimited list of property names.
878    * @return This object (for method chaining).
879    */
880   public BeanContextBuilder bpwo(String beanClassName, String value) {
881      return addTo(BEAN_bpwo, beanClassName, value);
882   }
883
884   /**
885    * Configuration property:  Debug mode.
886    *
887    * <p>
888    * Enables the following additional information during serialization:
889    * <ul class='spaced-list'>
890    *    <li>
891    *       When bean getters throws exceptions, the exception includes the object stack information
892    *       in order to determine how that method was invoked.
893    *    <li>
894    *       Enables {@link Serializer#BEANTRAVERSE_detectRecursions}.
895    * </ul>
896    *
897    * <ul class='seealso'>
898    *    <li class='jf'>{@link BeanContext#BEAN_debug}
899    * </ul>
900    *
901    * @param value
902    *    The new value for this property.
903    *    <br>The default is <jk>false</jk>.
904    * @return This object (for method chaining).
905    */
906   public BeanContextBuilder debug(boolean value) {
907      return set(BEAN_debug, value);
908   }
909
910   /**
911    * Configuration property:  Bean dictionary.
912    *
913    * <p>
914    * Adds to the list of classes that make up the bean dictionary in this bean context.
915    *
916    * <ul class='seealso'>
917    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
918    * </ul>
919    *
920    * @param values
921    *    The values to add to this property.
922    * @return This object (for method chaining).
923    */
924   public BeanContextBuilder dictionary(Object...values) {
925      return addTo(BEAN_beanDictionary, values);
926   }
927
928   /**
929    * Configuration property:  Bean dictionary.
930    *
931    * <p>
932    * Same as {@link #beanDictionary(Object...)} but takes in an array of classes.
933    *
934    * <ul class='seealso'>
935    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
936    * </ul>
937    *
938    * @param values
939    *    The values to add to this property.
940    * @return This object (for method chaining).
941    */
942   public BeanContextBuilder dictionary(Class<?>...values) {
943      return addTo(BEAN_beanDictionary, values);
944   }
945
946   /**
947    * Configuration property:  Bean dictionary.
948    *
949    * <p>
950    * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
951    *
952    * <ul class='seealso'>
953    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
954    * </ul>
955    *
956    * @param values
957    *    The new values for this property.
958    * @return This object (for method chaining).
959    */
960   public BeanContextBuilder dictionaryReplace(Class<?>...values) {
961      return set(BEAN_beanDictionary, values);
962   }
963
964   /**
965    * Configuration property:  Bean dictionary.
966    *
967    * <p>
968    * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
969    *
970    * <ul class='seealso'>
971    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
972    * </ul>
973    *
974    * @param values
975    *    The new values for this property.
976    * @return This object (for method chaining).
977    */
978   public BeanContextBuilder dictionaryReplace(Object...values) {
979      return set(BEAN_beanDictionary, values);
980   }
981
982   /**
983    * Configuration property:  Bean dictionary.
984    *
985    * <p>
986    * Removes from the list of classes that make up the bean dictionary in this bean context.
987    *
988    * <ul class='seealso'>
989    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
990    * </ul>
991    *
992    * @param values
993    *    The values to remove from this property.
994    * @return This object (for method chaining).
995    */
996   public BeanContextBuilder dictionaryRemove(Class<?>...values) {
997      return removeFrom(BEAN_beanDictionary, values);
998   }
999
1000   /**
1001    * Configuration property:  Bean dictionary.
1002    *
1003    * <p>
1004    * Removes from the list of classes that make up the bean dictionary in this bean context.
1005    *
1006    * <ul class='seealso'>
1007    *    <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
1008    * </ul>
1009    *
1010    * @param values
1011    *    The values to remove from this property.
1012    * @return This object (for method chaining).
1013    */
1014   public BeanContextBuilder dictionaryRemove(Object...values) {
1015      return removeFrom(BEAN_beanDictionary, values);
1016   }
1017
1018   /**
1019    * Configuration property:  Debug mode.
1020    *
1021    * <p>
1022    * Shortcut for calling <code>debug(<jk>true</jk>)</code>.
1023    *
1024    * <ul class='seealso'>
1025    *    <li class='jf'>{@link BeanContext#BEAN_debug}
1026    * </ul>
1027    *
1028    * @return This object (for method chaining).
1029    */
1030   public BeanContextBuilder debug() {
1031      return set(BEAN_debug, true);
1032   }
1033
1034   /**
1035    * Configuration property:  POJO example.
1036    *
1037    * <p>
1038    * Specifies an example of the specified class.
1039    *
1040    * <ul class='seealso'>
1041    *    <li class='jf'>{@link BeanContext#BEAN_examples}
1042    * </ul>
1043    *
1044    * @param pojoClass The POJO class.
1045    * @param o An instance of the POJO class used for examples.
1046    * @return This object (for method chaining).
1047    */
1048   public <T> BeanContextBuilder example(Class<T> pojoClass, T o) {
1049      return addTo(BEAN_examples, pojoClass.getName(), o);
1050   }
1051
1052   /**
1053    * Configuration property:  POJO example.
1054    *
1055    * <p>
1056    * Specifies an example of the specified class.
1057    *
1058    * <ul class='seealso'>
1059    *    <li class='jf'>{@link BeanContext#BEAN_examples}
1060    * </ul>
1061    *
1062    * @param <T> The POJO class type.
1063    * @param pojoClass The POJO class.
1064    * @param json The simple JSON representation of the example.
1065    * @return This object (for method chaining).
1066    */
1067   public <T> BeanContextBuilder exampleJson(Class<T> pojoClass, String json) {
1068      try {
1069         return addTo(BEAN_examples, pojoClass.getName(), SimpleJson.DEFAULT.read(json, pojoClass));
1070      } catch (ParseException e) {
1071         throw new RuntimeException(e);
1072      }
1073   }
1074
1075   /**
1076    * Configuration property:  POJO examples.
1077    *
1078    * <p>
1079    * Specifies an example of the specified class.
1080    *
1081    * <ul class='seealso'>
1082    *    <li class='jf'>{@link BeanContext#BEAN_examples}
1083    * </ul>
1084    *
1085    * @param json The simple JSON representation of the example.
1086    * @return This object (for method chaining).
1087    * @throws ParseException If parameter is not valid Simple-JSON.
1088    */
1089   public BeanContextBuilder examples(String json) throws ParseException {
1090      if (! isObjectMap(json, true))
1091         json = "{" + json + "}";
1092      ObjectMap m = new ObjectMap(json);
1093      for (Map.Entry<String,Object> e : m.entrySet())
1094         addTo(BEAN_examples, e.getKey(), e.getValue());
1095      return this;
1096   }
1097
1098   /**
1099    * Configuration property:  Bean property excludes.
1100    *
1101    * <div class='warn'>
1102    *    <b>Deprecated</b> - Use {@link #bpx(Class, String)}
1103    * </div>
1104    */
1105   @SuppressWarnings("javadoc")
1106   @Deprecated public BeanContextBuilder excludeProperties(Class<?> beanClass, String properties) {
1107      return addTo(BEAN_bpx, beanClass.getName(), properties);
1108   }
1109
1110   /**
1111    * Configuration property:  Bean property excludes.
1112    *
1113    * <div class='warn'>
1114    *    <b>Deprecated</b> - Use {@link #bpx(Map)}
1115    * </div>
1116    */
1117   @SuppressWarnings("javadoc")
1118   @Deprecated public BeanContextBuilder excludeProperties(Map<String,String> values) {
1119      return set(BEAN_bpx, values);
1120   }
1121
1122   /**
1123    * Configuration property:  Bean property excludes.
1124    *
1125    * <div class='warn'>
1126    *    <b>Deprecated</b> - Use {@link #bpx(String, String)}
1127    * </div>
1128    */
1129   @SuppressWarnings("javadoc")
1130   @Deprecated public BeanContextBuilder excludeProperties(String beanClassName, String value) {
1131      return addTo(BEAN_bpx, beanClassName, value);
1132   }
1133
1134   /**
1135    * Configuration property:  Find fluent setters.
1136    *
1137    * <p>
1138    * When enabled, fluent setters are detected on beans.
1139    *
1140    * <p>
1141    * Fluent setters must have the following attributes:
1142    * <ul>
1143    *    <li>Public.
1144    *    <li>Not static.
1145    *    <li>Take in one parameter.
1146    *    <li>Return the bean itself.
1147    * </ul>
1148    *
1149    * <ul class='seealso'>
1150    *    <li class='jf'>{@link BeanContext#BEAN_fluentSetters}
1151    * </ul>
1152    *
1153    * @param value
1154    *    The new value for this property.
1155    *    <br>The default is <jk>false</jk>.
1156    * @return This object (for method chaining).
1157    */
1158   public BeanContextBuilder fluentSetters(boolean value) {
1159      return set(BEAN_fluentSetters, value);
1160   }
1161
1162   /**
1163    * Configuration property:  Find fluent setters.
1164    *
1165    * <p>
1166    * Shortcut for calling <code>fluentSetters(<jk>true</jk>)</code>.
1167    *
1168    * <ul class='seealso'>
1169    *    <li class='jf'>{@link BeanContext#BEAN_fluentSetters}
1170    * </ul>
1171    *
1172    * @return This object (for method chaining).
1173    */
1174   public BeanContextBuilder fluentSetters() {
1175      return set(BEAN_fluentSetters, true);
1176   }
1177
1178   /**
1179    * Configuration property:  Ignore invocation errors on getters.
1180    *
1181    * <p>
1182    * If <jk>true</jk>, errors thrown when calling bean getter methods will silently be ignored.
1183    * Otherwise, a {@code BeanRuntimeException} is thrown.
1184    *
1185    * <ul class='seealso'>
1186    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnGetters}
1187    * </ul>
1188    *
1189    * @param value
1190    *    The new value for this property.
1191    *    <br>The default is <jk>false</jk>.
1192    * @return This object (for method chaining).
1193    */
1194   public BeanContextBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
1195      return set(BEAN_ignoreInvocationExceptionsOnGetters, value);
1196   }
1197
1198   /**
1199    * Configuration property:  Ignore invocation errors on getters.
1200    *
1201    * <p>
1202    * Shortcut for calling <code>ignoreInvocationExceptionsOnGetters(<jk>true</jk>)</code>.
1203    *
1204    * <ul class='seealso'>
1205    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnGetters}
1206    * </ul>
1207    *
1208    * @return This object (for method chaining).
1209    */
1210   public BeanContextBuilder ignoreInvocationExceptionsOnGetters() {
1211      return set(BEAN_ignoreInvocationExceptionsOnGetters, true);
1212   }
1213
1214   /**
1215    * Configuration property:  Ignore invocation errors on setters.
1216    *
1217    * <p>
1218    * If <jk>true</jk>, errors thrown when calling bean setter methods will silently be ignored.
1219    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
1220    *
1221    * <ul class='seealso'>
1222    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnSetters}
1223    * </ul>
1224    *
1225    * @param value
1226    *    The new value for this property.
1227    *    <br>The default is <jk>false</jk>.
1228    * @return This object (for method chaining).
1229    */
1230   public BeanContextBuilder ignoreInvocationExceptionsOnSetters(boolean value) {
1231      return set(BEAN_ignoreInvocationExceptionsOnSetters, value);
1232   }
1233
1234   /**
1235    * Configuration property:  Ignore invocation errors on setters.
1236    *
1237    * <p>
1238    * Shortcut for calling <code>ignoreInvocationExceptionsOnSetters(<jk>true</jk>)</code>.
1239    *
1240    * <ul class='seealso'>
1241    *    <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnSetters}
1242    * </ul>
1243    *
1244    * @return This object (for method chaining).
1245    */
1246   public BeanContextBuilder ignoreInvocationExceptionsOnSetters() {
1247      return set(BEAN_ignoreInvocationExceptionsOnSetters, true);
1248   }
1249
1250   /**
1251    * Configuration property:  Ignore properties without setters.
1252    *
1253    * <p>
1254    * If <jk>true</jk>, trying to set a value on a bean property without a setter will silently be ignored.
1255    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
1256    *
1257    * <ul class='seealso'>
1258    *    <li class='jf'>{@link BeanContext#BEAN_ignorePropertiesWithoutSetters}
1259    * </ul>
1260    *
1261    * @param value
1262    *    The new value for this property.
1263    *    <br>The default is <jk>true</jk>.
1264    * @return This object (for method chaining).
1265    */
1266   public BeanContextBuilder ignorePropertiesWithoutSetters(boolean value) {
1267      return set(BEAN_ignorePropertiesWithoutSetters, value);
1268   }
1269
1270   /**
1271    * Configuration property:  Ignore unknown properties.
1272    *
1273    * <p>
1274    * If <jk>true</jk>, trying to set a value on a non-existent bean property will silently be ignored.
1275    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
1276    *
1277    * <ul class='seealso'>
1278    *    <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownBeanProperties}
1279    * </ul>
1280    *
1281    * @param value
1282    *    The new value for this property.
1283    *    <br>The default is <jk>false</jk>.
1284    * @return This object (for method chaining).
1285    */
1286   public BeanContextBuilder ignoreUnknownBeanProperties(boolean value) {
1287      return set(BEAN_ignoreUnknownBeanProperties, value);
1288   }
1289
1290   /**
1291    * Configuration property:  Ignore unknown properties.
1292    *
1293    * <p>
1294    * Shortcut for calling <code>ignoreUnknownBeanProperties(<jk>true</jk>)</code>.
1295    *
1296    * <ul class='seealso'>
1297    *    <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownBeanProperties}
1298    * </ul>
1299    *
1300    * @return This object (for method chaining).
1301    */
1302   public BeanContextBuilder ignoreUnknownBeanProperties() {
1303      return set(BEAN_ignoreUnknownBeanProperties, true);
1304   }
1305
1306   /**
1307    * Configuration property:  Ignore unknown properties with null values.
1308    *
1309    * <p>
1310    * If <jk>true</jk>, trying to set a <jk>null</jk> value on a non-existent bean property will silently be ignored.
1311    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
1312    *
1313    * <ul class='seealso'>
1314    *    <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownNullBeanProperties}
1315    * </ul>
1316    *
1317    * @param value
1318    *    The new value for this property.
1319    *    <br>The default is <jk>true</jk>.
1320    * @return This object (for method chaining).
1321    */
1322   public BeanContextBuilder ignoreUnknownNullBeanProperties(boolean value) {
1323      return set(BEAN_ignoreUnknownNullBeanProperties, value);
1324   }
1325
1326   /**
1327    * Configuration property:  Implementation classes.
1328    *
1329    * <ul class='seealso'>
1330    *    <li class='jf'>{@link BeanContext#BEAN_implClasses}
1331    * </ul>
1332    *
1333    * @param interfaceClass The interface class.
1334    * @param implClass The implementation class.
1335    * @return This object (for method chaining).
1336    */
1337   public BeanContextBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
1338      return addTo(BEAN_implClasses, interfaceClass.getName(), implClass);
1339   }
1340
1341   /**
1342    * Configuration property:  Implementation classes.
1343    *
1344    * <p>
1345    * For interfaces and abstract classes this method can be used to specify an implementation class for the
1346    * interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a
1347    * parse).
1348    *
1349    * <ul class='seealso'>
1350    *    <li class='jf'>{@link BeanContext#BEAN_implClasses}
1351    * </ul>
1352    *
1353    * @param values The new value for this property.
1354    * @return This object (for method chaining).
1355    */
1356   public BeanContextBuilder implClasses(Map<String,Class<?>> values) {
1357      return set(BEAN_implClasses, values);
1358   }
1359
1360   /**
1361    * Configuration property:  Bean property includes.
1362    *
1363    * <div class='warn'>
1364    *    <b>Deprecated</b> - Use {@link #bpi(Class, String)}
1365    * </div>
1366    */
1367   @SuppressWarnings("javadoc")
1368   @Deprecated public BeanContextBuilder includeProperties(Class<?> beanClass, String value) {
1369      return addTo(BEAN_bpi, beanClass.getName(), value);
1370   }
1371
1372   /**
1373    * Configuration property:  Bean property includes.
1374    *
1375    * <div class='warn'>
1376    *    <b>Deprecated</b> - Use {@link #bpi(Map)}
1377    * </div>
1378    */
1379   @SuppressWarnings("javadoc")
1380   @Deprecated public BeanContextBuilder includeProperties(Map<String,String> values) {
1381      return set(BEAN_bpi, values);
1382   }
1383
1384   /**
1385    * Configuration property:  Bean property includes.
1386    *
1387    * <div class='warn'>
1388    *    <b>Deprecated</b> - Use {@link #bpi(String, String)}
1389    * </div>
1390    */
1391   @SuppressWarnings("javadoc")
1392   @Deprecated public BeanContextBuilder includeProperties(String beanClassName, String value) {
1393      return addTo(BEAN_bpi, beanClassName, value);
1394   }
1395
1396   /**
1397    * Configuration property:  Locale.
1398    *
1399    * <p>
1400    * Specifies a default locale for serializer and parser sessions.
1401    *
1402    * <ul class='seealso'>
1403    *    <li class='jf'>{@link BeanContext#BEAN_locale}
1404    * </ul>
1405    *
1406    * @param value The new value for this property.
1407    * @return This object (for method chaining).
1408    */
1409   public BeanContextBuilder locale(Locale value) {
1410      return set(BEAN_locale, value);
1411   }
1412
1413   /**
1414    * Configuration property:  Media type.
1415    *
1416    * <p>
1417    * Specifies a default media type value for serializer and parser sessions.
1418    *
1419    * <ul class='seealso'>
1420    *    <li class='jf'>{@link BeanContext#BEAN_mediaType}
1421    * </ul>
1422    *
1423    * @param value The new value for this property.
1424    * @return This object (for method chaining).
1425    */
1426   public BeanContextBuilder mediaType(MediaType value) {
1427      return set(BEAN_mediaType, value);
1428   }
1429
1430   /**
1431    * Configuration property:  Bean class exclusions.
1432    *
1433    * <p>
1434    * List of classes that should not be treated as beans even if they appear to be bean-like.
1435    * <br>Not-bean classes are converted to <c>Strings</c> during serialization.
1436    *
1437    * <ul class='seealso'>
1438    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1439    * </ul>
1440    *
1441    * @param values The values to add to this property.
1442    * @return This object (for method chaining).
1443    */
1444   public BeanContextBuilder notBeanClasses(Class<?>...values) {
1445      return addTo(BEAN_notBeanClasses, values);
1446   }
1447
1448   /**
1449    * Configuration property:  Bean class exclusions.
1450    *
1451    * <p>
1452    * List of classes that should not be treated as beans even if they appear to be bean-like.
1453    * <br>Not-bean classes are converted to <c>Strings</c> during serialization.
1454    *
1455    * <ul class='seealso'>
1456    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1457    * </ul>
1458    *
1459    * @param values
1460    *    The values to add to this property.
1461    *    <br>Values can consist of any of the following types:
1462    *    <ul>
1463    *       <li>Classes.
1464    *       <li>Arrays and collections of classes.
1465    *    </ul>
1466    * @return This object (for method chaining).
1467    */
1468   public BeanContextBuilder notBeanClasses(Object...values) {
1469      return addTo(BEAN_notBeanClasses, values);
1470   }
1471
1472   /**
1473    * Configuration property:  Bean class exclusions.
1474    *
1475    * <p>
1476    * Not-bean classes are converted to <c>Strings</c> during serialization even if they appear to be
1477    * bean-like.
1478    *
1479    * <ul class='seealso'>
1480    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1481    * </ul>
1482    *
1483    * @param values
1484    *    The new value for this property.
1485    * @return This object (for method chaining).
1486    */
1487   public BeanContextBuilder notBeanClassesReplace(Class<?>...values) {
1488      return set(BEAN_notBeanClasses, values);
1489   }
1490
1491   /**
1492    * Configuration property:  Bean class exclusions.
1493    *
1494    * <p>
1495    * Not-bean classes are converted to <c>Strings</c> during serialization even if they appear to be
1496    * bean-like.
1497    *
1498    * <ul class='seealso'>
1499    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1500    * </ul>
1501    *
1502    * @param values
1503    *    The new value for this property.
1504    *    <br>Values can consist of any of the following types:
1505    *    <ul>
1506    *       <li>Classes.
1507    *       <li>Arrays and collections of classes.
1508    *    </ul>
1509    * @return This object (for method chaining).
1510    */
1511   public BeanContextBuilder notBeanClassesReplace(Object...values) {
1512      return set(BEAN_notBeanClasses, values);
1513   }
1514
1515   /**
1516    * Configuration property:  Bean class exclusions.
1517    *
1518    * <ul class='seealso'>
1519    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1520    * </ul>
1521    *
1522    * @param values
1523    *    The values to remove from this property.
1524    * @return This object (for method chaining).
1525    */
1526   public BeanContextBuilder notBeanClassesRemove(Class<?>...values) {
1527      return removeFrom(BEAN_notBeanClasses, values);
1528   }
1529
1530   /**
1531    * Configuration property:  Bean class exclusions.
1532    *
1533    * <ul class='seealso'>
1534    *    <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
1535    * </ul>
1536    *
1537    * @param values
1538    *    The values to remove from this property.
1539    *    <br>Values can consist of any of the following types:
1540    *    <ul>
1541    *       <li>Classes.
1542    *       <li>Arrays and collections of classes.
1543    *    </ul>
1544    * @return This object (for method chaining).
1545    */
1546   public BeanContextBuilder notBeanClassesRemove(Object...values) {
1547      return removeFrom(BEAN_notBeanClasses, values);
1548   }
1549
1550   /**
1551    * Configuration property:  Bean package exclusions.
1552    *
1553    * <ul class='seealso'>
1554    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1555    * </ul>
1556    *
1557    * @param values
1558    *    The values to add to this property.
1559    * @return This object (for method chaining).
1560    */
1561   public BeanContextBuilder notBeanPackages(String...values) {
1562      return addTo(BEAN_notBeanPackages, values);
1563   }
1564
1565   /**
1566    * Configuration property:  Bean package exclusions.
1567    *
1568    * <ul class='seealso'>
1569    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1570    * </ul>
1571    *
1572    * @param values
1573    *    The values to add to this property.
1574    *    <br>Values can consist of any of the following types:
1575    *    <ul>
1576    *       <li>Strings.
1577    *       <li>Arrays and collections of strings.
1578    *    </ul>
1579    * @return This object (for method chaining).
1580    */
1581   public BeanContextBuilder notBeanPackages(Object...values) {
1582      return addTo(BEAN_notBeanPackages, values);
1583   }
1584
1585   /**
1586    * Configuration property:  Bean package exclusions.
1587    *
1588    * <ul class='seealso'>
1589    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1590    * </ul>
1591    *
1592    * @param values
1593    *    <br>Values can consist of any of the following types:
1594    * @return This object (for method chaining).
1595    */
1596   public BeanContextBuilder notBeanPackagesReplace(String...values) {
1597      return set(BEAN_notBeanPackages, values);
1598   }
1599
1600   /**
1601    * Configuration property:  Bean package exclusions.
1602    *
1603    * <ul class='seealso'>
1604    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1605    * </ul>
1606    *
1607    * @param values
1608    *    <br>Values can consist of any of the following types:
1609    *    <br>Possible values are:
1610    *    <ul>
1611    *       <li>Strings.
1612    *       <li>Arrays and collections of strings.
1613    *    </ul>
1614    * @return This object (for method chaining).
1615    */
1616   public BeanContextBuilder notBeanPackagesReplace(Object...values) {
1617      return set(BEAN_notBeanPackages, values);
1618   }
1619
1620   /**
1621    * Configuration property:  Bean package exclusions.
1622    *
1623    * <ul class='seealso'>
1624    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1625    * </ul>
1626    *
1627    * @param values The values to remove from this property.
1628    * @return This object (for method chaining).
1629    */
1630   public BeanContextBuilder notBeanPackagesRemove(String...values) {
1631      return removeFrom(BEAN_notBeanPackages, values);
1632   }
1633
1634   /**
1635    * Configuration property:  Bean package exclusions.
1636    *
1637    * <ul class='seealso'>
1638    *    <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
1639    * </ul>
1640    *
1641    * @param values
1642    *    <br>Values can consist of any of the following types:
1643    *    <br>Possible values are:
1644    *    <ul>
1645    *       <li>Strings.
1646    *       <li>Arrays and collections of strings.
1647    *    </ul>
1648    * @return This object (for method chaining).
1649    */
1650   public BeanContextBuilder notBeanPackagesRemove(Object...values) {
1651      return removeFrom(BEAN_notBeanPackages, values);
1652   }
1653
1654   /**
1655    * Configuration property:  POJO swaps.
1656    *
1657    * <ul class='seealso'>
1658    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1659    * </ul>
1660    *
1661    * @param values The values to add to this property.
1662    * @return This object (for method chaining).
1663    */
1664   public BeanContextBuilder pojoSwaps(Class<?>...values) {
1665      return addTo(BEAN_pojoSwaps, values);
1666   }
1667
1668   /**
1669    * Configuration property:  POJO swaps.
1670    *
1671    * <ul class='seealso'>
1672    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1673    * </ul>
1674    *
1675    * @param values
1676    *    The values to add to this property.
1677    *    <br>Values can consist of any of the following types:
1678    *    <ul>
1679    *       <li>Any subclass of {@link PojoSwap}.
1680    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
1681    *       <li>Any array or collection of the objects above.
1682    *    </ul>
1683    * @return This object (for method chaining).
1684    */
1685   public BeanContextBuilder pojoSwaps(Object...values) {
1686      return addTo(BEAN_pojoSwaps, values);
1687   }
1688
1689   /**
1690    * Configuration property:  POJO swaps.
1691    *
1692    * <ul class='seealso'>
1693    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1694    * </ul>
1695    *
1696    * @param values
1697    *    The values to remove from this property.
1698    *    <br>Values can consist of any of the following types:
1699    *    <ul>
1700    *       <li>Any subclass of {@link PojoSwap}.
1701    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
1702    *       <li>Any array or collection of the objects above.
1703    *    </ul>
1704    * @return This object (for method chaining).
1705    */
1706   public BeanContextBuilder pojoSwapsReplace(Class<?>...values) {
1707      return set(BEAN_pojoSwaps, values);
1708   }
1709
1710   /**
1711    * Configuration property:  POJO swaps.
1712    *
1713    * <ul class='seealso'>
1714    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1715    * </ul>
1716    *
1717    * @param values
1718    *    The values to remove from this property.
1719    *    <br>Values can consist of any of the following types:
1720    *    <ul>
1721    *       <li>Any subclass of {@link PojoSwap}.
1722    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
1723    *       <li>Any array or collection of the objects above.
1724    *    </ul>
1725    * @return This object (for method chaining).
1726    */
1727   public BeanContextBuilder pojoSwapsReplace(Object...values) {
1728      return set(BEAN_pojoSwaps, values);
1729   }
1730
1731   /**
1732    * Configuration property:  POJO swaps.
1733    *
1734    * <ul class='seealso'>
1735    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1736    * </ul>
1737    *
1738    * @param values
1739    *    The values to remove from this property.
1740    *    <br>Values can consist of any of the following types:
1741    *    <ul>
1742    *       <li>Any subclass of {@link PojoSwap}.
1743    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
1744    *    </ul>
1745    * @return This object (for method chaining).
1746    */
1747   public BeanContextBuilder pojoSwapsRemove(Class<?>...values) {
1748      return removeFrom(BEAN_pojoSwaps, values);
1749   }
1750
1751   /**
1752    * Configuration property:  POJO swaps.
1753    *
1754    * <ul class='seealso'>
1755    *    <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
1756    * </ul>
1757    *
1758    * @param values
1759    *    The values to remove from this property.
1760    *    <br>Values can consist of any of the following types:
1761    *    <ul>
1762    *       <li>Any subclass of {@link PojoSwap}.
1763    *       <li>Any surrogate class.  A shortcut for defining a {@link SurrogateSwap}.
1764    *       <li>Any array or collection of the objects above.
1765    *    </ul>
1766    * @return This object (for method chaining).
1767    */
1768   public BeanContextBuilder pojoSwapsRemove(Object...values) {
1769      return removeFrom(BEAN_pojoSwaps, values);
1770   }
1771
1772   /**
1773    * Configuration property:  Bean property namer
1774    *
1775    * <p>
1776    * The class to use for calculating bean property names.
1777    *
1778    * <ul class='seealso'>
1779    *    <li class='jf'>{@link BeanContext#BEAN_propertyNamer}
1780    * </ul>
1781    *
1782    * @param value
1783    *    The new value for this setting.
1784    *    <br>The default is {@link PropertyNamerDefault}.
1785    * @return This object (for method chaining).
1786    */
1787   public BeanContextBuilder propertyNamer(Class<? extends PropertyNamer> value) {
1788      return set(BEAN_propertyNamer, value);
1789   }
1790
1791   /**
1792    * Configuration property:  Sort bean properties.
1793    *
1794    * <p>
1795    * When <jk>true</jk>, all bean properties will be serialized and access in alphabetical order.
1796    * Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
1797    *
1798    * <ul class='seealso'>
1799    *    <li class='jf'>{@link BeanContext#BEAN_sortProperties}
1800    * </ul>
1801    *
1802    * @param value
1803    *    The new value for this property.
1804    *    <br>The default is <jk>false</jk>.
1805    * @return This object (for method chaining).
1806    */
1807   public BeanContextBuilder sortProperties(boolean value) {
1808      return set(BEAN_sortProperties, value);
1809   }
1810
1811   /**
1812    * Configuration property:  Sort bean properties.
1813    *
1814    * <p>
1815    * Shortcut for calling <code>sortProperties(<jk>true</jk>)</code>.
1816    *
1817    * <ul class='seealso'>
1818    *    <li class='jf'>{@link BeanContext#BEAN_sortProperties}
1819    * </ul>
1820    *
1821    * @return This object (for method chaining).
1822    */
1823   public BeanContextBuilder sortProperties() {
1824      return set(BEAN_sortProperties, true);
1825   }
1826
1827   /**
1828    * Configuration property:  TimeZone.
1829    *
1830    * <ul class='seealso'>
1831    *    <li class='jf'>{@link BeanContext#BEAN_timeZone}
1832    * </ul>
1833    *
1834    * @param value The new value for this property.
1835    * @return This object (for method chaining).
1836    */
1837   public BeanContextBuilder timeZone(TimeZone value) {
1838      return set(BEAN_timeZone, value);
1839   }
1840
1841   /**
1842    * Configuration property:  Use enum names.
1843    *
1844    * <p>
1845    * When enabled, enums are always serialized by name instead of using {@link Object#toString()}.
1846    *
1847    * <ul class='seealso'>
1848    *    <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
1849    * </ul>
1850    *
1851    * @param value The property value.
1852    * @return This object (for method chaining).
1853    */
1854   public BeanContextBuilder useEnumNames(boolean value) {
1855      return set(BEAN_useEnumNames, value);
1856   }
1857
1858   /**
1859    * Configuration property:  Use enum names.
1860    *
1861    * <p>
1862    * When enabled, enums are always serialized by name instead of using {@link Object#toString()}.
1863    *
1864    * <ul class='seealso'>
1865    *    <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
1866    * </ul>
1867    *
1868    * @return This object (for method chaining).
1869    */
1870   public BeanContextBuilder useEnumNames() {
1871      return set(BEAN_useEnumNames, true);
1872   }
1873
1874   /**
1875    * Configuration property:  Use interface proxies.
1876    *
1877    * <p>
1878    * If <jk>true</jk>, then interfaces will be instantiated as proxy classes through the use of an
1879    * {@link InvocationHandler} if there is no other way of instantiating them.
1880    *
1881    * <ul class='seealso'>
1882    *    <li class='jf'>{@link BeanContext#BEAN_useInterfaceProxies}
1883    * </ul>
1884    *
1885    * @param value
1886    *    The new value for this property.
1887    *    <br>The default is <jk>true</jk>.
1888    * @return This object (for method chaining).
1889    */
1890   public BeanContextBuilder useInterfaceProxies(boolean value) {
1891      return set(BEAN_useInterfaceProxies, value);
1892   }
1893
1894   /**
1895    * Configuration property:  Use Java Introspector.
1896    *
1897    * <p>
1898    * Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
1899    *
1900    * <ul class='notes'>
1901    *    <li>Most {@link Bean @Bean} annotations will be ignored if you enable this setting.
1902    * </ul>
1903    *
1904    * <ul class='seealso'>
1905    *    <li class='jf'>{@link BeanContext#BEAN_useJavaBeanIntrospector}
1906    * </ul>
1907    *
1908    * @param value
1909    *    The new value for this property.
1910    *    <br>The default is <jk>false</jk>.
1911    * @return This object (for method chaining).
1912    */
1913   public BeanContextBuilder useJavaBeanIntrospector(boolean value) {
1914      return set(BEAN_useJavaBeanIntrospector, value);
1915   }
1916
1917   /**
1918    * Configuration property:  Use Java Introspector.
1919    *
1920    * <p>
1921    * Shortcut for calling <code>useJavaBeanIntrospector(<jk>true</jk>)</code>.
1922    *
1923    * <ul class='seealso'>
1924    *    <li class='jf'>{@link BeanContext#BEAN_useJavaBeanIntrospector}
1925    * </ul>
1926    *
1927    * @return This object (for method chaining).
1928    */
1929   public BeanContextBuilder useJavaBeanIntrospector() {
1930      return set(BEAN_useJavaBeanIntrospector, true);
1931   }
1932
1933   @Override /* ContextBuilder */
1934   public BeanContextBuilder set(String name, Object value) {
1935      super.set(name, value);
1936      return this;
1937   }
1938
1939   @Override /* ContextBuilder */
1940   public BeanContextBuilder set(Map<String,Object> properties) {
1941      super.set(properties);
1942      return this;
1943   }
1944
1945   @Override /* ContextBuilder */
1946   public BeanContextBuilder add(Map<String,Object> properties) {
1947      super.add(properties);
1948      return this;
1949   }
1950
1951   @Override /* ContextBuilder */
1952   public BeanContextBuilder addTo(String name, Object value) {
1953      super.addTo(name, value);
1954      return this;
1955   }
1956
1957   @Override /* ContextBuilder */
1958   public BeanContextBuilder addTo(String name, String key, Object value) {
1959      super.addTo(name, key, value);
1960      return this;
1961   }
1962
1963   @Override /* ContextBuilder */
1964   public BeanContextBuilder removeFrom(String name, Object value) {
1965      super.removeFrom(name, value);
1966      return this;
1967   }
1968
1969   @Override /* ContextBuilder */
1970   public BeanContextBuilder apply(PropertyStore copyFrom) {
1971      super.apply(copyFrom);
1972      return this;
1973   }
1974
1975   @Override /* ContextBuilder */
1976   public BeanContextBuilder applyAnnotations(AnnotationList al, VarResolverSession vrs) {
1977      super.applyAnnotations(al, vrs);
1978      return this;
1979   }
1980
1981   @Override /* ContextBuilder */
1982   public BeanContextBuilder applyAnnotations(Class<?>...fromClasses) {
1983      super.applyAnnotations(fromClasses);
1984      return this;
1985   }
1986
1987   @Override /* ContextBuilder */
1988   public BeanContextBuilder applyAnnotations(Method...fromMethods) {
1989      super.applyAnnotations(fromMethods);
1990      return this;
1991   }
1992}