001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.annotation;
018
019import static java.lang.annotation.ElementType.*;
020import static java.lang.annotation.RetentionPolicy.*;
021
022import java.io.*;
023import java.lang.annotation.*;
024import java.lang.reflect.*;
025import java.util.*;
026
027import org.apache.juneau.*;
028import org.apache.juneau.swap.*;
029
030/**
031 * Annotation for specifying config properties defined in {@link BeanContext} and {@link BeanTraverseContext}.
032 *
033 * <p>
034 * Used primarily for specifying bean configuration properties on REST classes and methods.
035 *
036 */
037@Target({ TYPE, METHOD })
038@Retention(RUNTIME)
039@Inherited
040@ContextApply(BeanConfigAnnotation.Applier.class)
041public @interface BeanConfig {
042
043   /**
044    * Minimum bean class visibility.
045    *
046    * <p>
047    * Classes are not considered beans unless they meet the minimum visibility requirements.
048    *
049    * <p>
050    * For example, if the visibility is <c>PUBLIC</c> and the bean class is <jk>protected</jk>, then the class
051    * will not be interpreted as a bean class and be serialized as a string.
052    * <br>Use this setting to reduce the visibility requirement.
053    *
054    * <ul class='values'>
055    *    <li><js>"PUBLIC"</js> (default)
056    *    <li><js>"PROTECTED"</js>
057    *    <li><js>"DEFAULT"</js>
058    *    <li><js>"PRIVATE"</js>
059    * </ul>
060    *
061    * <h5 class='section'>Notes:</h5><ul>
062    *    <li class='note'>
063    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
064    * </ul>
065    *
066    * <h5 class='section'>See Also:</h5><ul>
067    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanClassVisibility(Visibility)}
068    * </ul>
069    *
070    * @return The annotation value.
071    */
072   String beanClassVisibility() default "";
073
074   /**
075    * Minimum bean constructor visibility.
076    *
077    * <p>
078    * Only look for constructors with the specified minimum visibility.
079    *
080    * <p>
081    * This setting affects the logic for finding no-arg constructors for bean.
082    * <br>Normally, only <jk>public</jk> no-arg constructors are used.
083    * <br>Use this setting if you want to reduce the visibility requirement.
084    *
085    * <ul class='values'>
086    *    <li><js>"PUBLIC"</js> (default)
087    *    <li><js>"PROTECTED"</js>
088    *    <li><js>"DEFAULT"</js>
089    *    <li><js>"PRIVATE"</js>
090    * </ul>
091    *
092    * <h5 class='section'>Notes:</h5><ul>
093    *    <li class='note'>
094    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
095    * </ul>
096    *
097    * <h5 class='section'>See Also:</h5><ul>
098    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanConstructorVisibility(Visibility)}
099    * </ul>
100    *
101    * @return The annotation value.
102    */
103   String beanConstructorVisibility() default "";
104
105   /**
106    * Minimum bean field visibility.
107    *
108    * <p>
109    * Only look for bean fields with the specified minimum visibility.
110    *
111    * <p>
112    * This affects which fields on a bean class are considered bean properties.
113    * <br>Normally only <jk>public</jk> fields are considered.
114    * <br>Use this setting if you want to reduce the visibility requirement.
115    *
116    * <ul class='values'>
117    *    <li><js>"PUBLIC"</js> (default)
118    *    <li><js>"PROTECTED"</js>
119    *    <li><js>"DEFAULT"</js>
120    *    <li><js>"PRIVATE"</js>
121    * </ul>
122    *
123    * <h5 class='section'>Notes:</h5><ul>
124    *    <li class='note'>
125    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
126    * </ul>
127    *
128    * <h5 class='section'>See Also:</h5><ul>
129    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanFieldVisibility(Visibility)}
130    * </ul>
131    *
132    * @return The annotation value.
133    */
134   String beanFieldVisibility() default "";
135
136   /**
137    * BeanMap.put() returns old property value.
138    *
139    * <p>
140    * If <js>"true"</js>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property
141    * values.
142    * <br>Otherwise, it returns <jk>null</jk>.
143    *
144    * <ul class='values'>
145    *    <li><js>"true"</js>
146    *    <li><js>"false"</js> (default because it introduces a slight performance penalty during serialization)
147    * </ul>
148    *
149    * <h5 class='section'>Notes:</h5><ul>
150    *    <li class='note'>
151    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
152    * </ul>
153    *
154    * <h5 class='section'>See Also:</h5><ul>
155    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanMapPutReturnsOldValue()}
156    * </ul>
157    *
158    * @return The annotation value.
159    */
160   String beanMapPutReturnsOldValue() default "";
161
162   /**
163    * Minimum bean method visibility.
164    *
165    * <p>
166    * Only look for bean methods with the specified minimum visibility.
167    *
168    * <p>
169    * This affects which methods are detected as getters and setters on a bean class.
170    * <br>Normally only <jk>public</jk> getters and setters are considered.
171    * <br>Use this setting if you want to reduce the visibility requirement.
172    *
173    * <ul class='values'>
174    *    <li><js>"PUBLIC"</js> (default)
175    *    <li><js>"PROTECTED"</js>
176    *    <li><js>"DEFAULT"</js>
177    *    <li><js>"PRIVATE"</js>
178    * </ul>
179    *
180    * <h5 class='section'>Notes:</h5><ul>
181    *    <li class='note'>
182    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
183    * </ul>
184    *
185    * <h5 class='section'>See Also:</h5><ul>
186    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanMethodVisibility(Visibility)}
187    * </ul>
188    *
189    * @return The annotation value.
190    */
191   String beanMethodVisibility() default "";
192
193   /**
194    * Beans require no-arg constructors.
195    *
196    * <p>
197    * If <js>"true"</js>, a Java class must implement a default no-arg constructor to be considered a bean.
198    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
199    *
200    * <ul class='values'>
201    *    <li><js>"true"</js>
202    *    <li><js>"false"</js> (default)
203    * </ul>
204    *
205    * <h5 class='section'>Notes:</h5><ul>
206    *    <li class='note'>
207    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
208    *    <li class='note'>
209    *       The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>.
210    * </ul>
211    *
212    * <h5 class='section'>See Also:</h5><ul>
213    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beansRequireDefaultConstructor()}
214    * </ul>
215    *
216    * @return The annotation value.
217    */
218   String beansRequireDefaultConstructor() default "";
219
220   /**
221    * Beans require Serializable interface.
222    *
223    * <p>
224    * If <js>"true"</js>, a Java class must implement the {@link Serializable} interface to be considered a bean.
225    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
226    *
227    * <ul class='values'>
228    *    <li><js>"true"</js>
229    *    <li><js>"false"</js> (default)
230    * </ul>
231    *
232    * <h5 class='section'>Notes:</h5><ul>
233    *    <li class='note'>
234    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
235    *    <li class='note'>
236    *       The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>.
237    * </ul>
238    *
239    * <h5 class='section'>See Also:</h5><ul>
240    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beansRequireSerializable()}
241    * </ul>
242    *
243    * @return The annotation value.
244    */
245   String beansRequireSerializable() default "";
246
247   /**
248    * Beans require setters for getters.
249    *
250    * <p>
251    * If <js>"true"</js>, only getters that have equivalent setters will be considered as properties on a bean.
252    * <br>Otherwise, they will be ignored.
253    *
254    * <ul class='values'>
255    *    <li><js>"true"</js>
256    *    <li><js>"false"</js> (default)
257    * </ul>
258    *
259    * <h5 class='section'>Notes:</h5><ul>
260    *    <li class='note'>
261    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
262    * </ul>
263    *
264    * <h5 class='section'>See Also:</h5><ul>
265    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beansRequireSettersForGetters()}
266    * </ul>
267    *
268    * @return The annotation value.
269    */
270   String beansRequireSettersForGetters() default "";
271
272   /**
273    * Debug mode.
274    *
275    * <p>
276    * Enables the following additional information during serialization:
277    * <ul class='spaced-list'>
278    *    <li>
279    *       When bean getters throws exceptions, the exception includes the object stack information
280    *       in order to determine how that method was invoked.
281    *    <li>
282    *       Enables {@link org.apache.juneau.BeanTraverseContext.Builder#detectRecursions()}.
283    * </ul>
284    *
285    * <p>
286    * Enables the following additional information during parsing:
287    * <ul class='spaced-list'>
288    *    <li>
289    *       When bean setters throws exceptions, the exception includes the object stack information
290    *       in order to determine how that method was invoked.
291    * </ul>
292    *
293    * <ul class='values'>
294    *    <li><js>"true"</js>
295    *    <li><js>"false"</js> (default)
296    * </ul>
297    *
298    * <h5 class='section'>Notes:</h5><ul>
299    *    <li class='note'>
300    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
301    * </ul>
302    *
303    * <h5 class='section'>See Also:</h5><ul>
304    *    <li class='jm'>{@link org.apache.juneau.Context.Builder#debug()}
305    * </ul>
306    *
307    * @return The annotation value.
308    */
309   String debug() default "";
310
311   /**
312    * Bean dictionary.
313    *
314    * <p>
315    * The list of classes that make up the bean dictionary in this bean context.
316    *
317    * <p>
318    * A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred
319    * through reflection.
320    * <br>The names are defined through the {@link Bean#typeName() @Bean(typeName)} annotation defined on the bean class.
321    * <br>For example, if a class <c>Foo</c> has a type-name of <js>"myfoo"</js>, then it would end up serialized
322    * as <js>"{_type:'myfoo',...}"</js>.
323    *
324    * <p>
325    * This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes.
326    *
327    * <h5 class='section'>See Also:</h5><ul>
328    *    <li class='ja'>{@link Bean#dictionary()}
329    *    <li class='ja'>{@link Beanp#dictionary()}
330    *    <li class='ja'>{@link BeanConfig#dictionary_replace()}
331    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanDictionary(Class...)}
332    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/BeanDictionaryBasics">Bean Dictionary Basics</a>
333    * </ul>
334    *
335    * @return The annotation value.
336    */
337   Class<?>[] dictionary() default {};
338
339   /**
340    * Replace bean dictionary.
341    *
342    * <p>
343    * Same as {@link #dictionary()} but replaces any existing value.
344    *
345    * <h5 class='section'>See Also:</h5><ul>
346    *    <li class='ja'>{@link Bean#dictionary()}
347    *    <li class='ja'>{@link Beanp#dictionary()}
348    *    <li class='ja'>{@link BeanConfig#dictionary()}
349    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#beanDictionary(Class...)}
350    * </ul>
351    *
352    * @return The annotation value.
353    */
354   Class<?>[] dictionary_replace() default {};
355
356   /**
357    * Beans don't require at least one property.
358    *
359    * <p>
360    * If <js>"true"</js>, then a Java class doesn't need to contain at least 1 property to be considered a bean.
361    * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
362    *
363    * <ul class='values'>
364    *    <li><js>"true"</js>
365    *    <li><js>"false"</js> (default)
366    * </ul>
367    *
368    * <h5 class='section'>Notes:</h5><ul>
369    *    <li class='note'>
370    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
371    * </ul>
372    *
373    * <h5 class='section'>See Also:</h5><ul>
374    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#disableBeansRequireSomeProperties()}
375    * </ul>
376    *
377    * @return The annotation value.
378    */
379   String disableBeansRequireSomeProperties() default "";
380
381   /**
382    * Don't silently ignore missing setters.
383    *
384    * <p>
385    * If <js>"true"</js>, trying to set a value on a bean property without a setter will throw a {@code BeanRuntimeException}.
386    * <br>Otherwise it will be sliently ignored.
387    *
388    * <ul class='values'>
389    *    <li><js>"true"</js>
390    *    <li><js>"false"</js> (default)
391    * </ul>
392    *
393    * <h5 class='section'>Notes:</h5><ul>
394    *    <li class='note'>
395    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
396    * </ul>
397    *
398    * <h5 class='section'>See Also:</h5><ul>
399    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#disableIgnoreMissingSetters()}
400    * </ul>
401    *
402    * @return The annotation value.
403    */
404   String disableIgnoreMissingSetters() default "";
405
406   /**
407    * Don't ignore transient fields.
408    *
409    * <p>
410    * If <jk>true</jk>, methods and fields marked as <jk>transient</jk> will not be ignored as bean properties.
411    *
412    * <ul class='values'>
413    *    <li><js>"true"</js>
414    *    <li><js>"false"</js> (default)
415    * </ul>
416    *
417    * <h5 class='section'>Notes:</h5><ul>
418    *    <li class='note'>
419    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
420    * </ul>
421    *
422    * <h5 class='section'>See Also:</h5><ul>
423    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#disableIgnoreTransientFields()}
424    * </ul>
425    *
426    * @return The annotation value.
427    */
428   String disableIgnoreTransientFields() default "";
429
430   /**
431    * Don't ignore unknown properties with null values.
432    *
433    * <p>
434    * If <js>"true"</js>, trying to set a <jk>null</jk> value on a non-existent bean property will throw a {@code BeanRuntimeException}.
435    * Otherwise it will be silently ignored.
436    *
437    * <ul class='values'>
438    *    <li><js>"true"</js>
439    *    <li><js>"false"</js> (default)
440    * </ul>
441    *
442    * <h5 class='section'>Notes:</h5><ul>
443    *    <li class='note'>
444    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
445    * </ul>
446    *
447    * <h5 class='section'>See Also:</h5><ul>
448    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#disableIgnoreUnknownNullBeanProperties()}
449    * </ul>
450    *
451    * @return The annotation value.
452    */
453   String disableIgnoreUnknownNullBeanProperties() default "";
454
455   /**
456    * Don't use interface proxies.
457    *
458    * <p>
459    * Disables the feature where interfaces will be instantiated as proxy classes through the use of an
460    * {@link InvocationHandler} if there is no other way of instantiating them.
461    * <br>Setting this to <js>"true"</js> causes this to be a {@link org.apache.juneau.commons.reflect.BeanRuntimeException}.
462    *
463    * <ul class='values'>
464    *    <li><js>"true"</js>
465    *    <li><js>"false"</js> (default)
466    * </ul>
467    *
468    * <h5 class='section'>Notes:</h5><ul>
469    *    <li class='note'>
470    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
471    * </ul>
472    *
473    * <h5 class='section'>See Also:</h5><ul>
474    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#disableInterfaceProxies()}
475    * </ul>
476    *
477    * @return The annotation value.
478    */
479   String disableInterfaceProxies() default "";
480
481   /**
482    * Find fluent setters.
483    *
484    * <p>
485    * When enabled, fluent setters are detected on beans.
486    *
487    * <p>
488    * Fluent setters must have the following attributes:
489    * <ul>
490    *    <li>Public.
491    *    <li>Not static.
492    *    <li>Take in one parameter.
493    *    <li>Return the bean itself.
494    * </ul>
495    *
496    * <ul class='values'>
497    *    <li><js>"true"</js>
498    *    <li><js>"false"</js> (default)
499    * </ul>
500    *
501    * <h5 class='section'>Notes:</h5><ul>
502    *    <li class='note'>
503    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
504    * </ul>
505    *
506    * <h5 class='section'>See Also:</h5><ul>
507    *    <li class='ja'>{@link Bean#findFluentSetters()}
508    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#findFluentSetters()}
509    * </ul>
510    *
511    * @return The annotation value.
512    */
513   String findFluentSetters() default "";
514
515   /**
516    * Ignore invocation errors on getters.
517    *
518    * <p>
519    * If <js>"true"</js>, errors thrown when calling bean getter methods will silently be ignored.
520    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
521    *
522    * <ul class='values'>
523    *    <li><js>"true"</js>
524    *    <li><js>"false"</js> (default)
525    * </ul>
526    *
527    * <h5 class='section'>Notes:</h5><ul>
528    *    <li class='note'>
529    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
530    * </ul>
531    *
532    * <h5 class='section'>See Also:</h5><ul>
533    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#ignoreInvocationExceptionsOnGetters()}
534    * </ul>
535    *
536    * @return The annotation value.
537    */
538   String ignoreInvocationExceptionsOnGetters() default "";
539
540   /**
541    * Ignore invocation errors on setters.
542    *
543    * <p>
544    * If <js>"true"</js>, errors thrown when calling bean setter methods will silently be ignored.
545    * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
546    *
547    * <ul class='values'>
548    *    <li><js>"true"</js>
549    *    <li><js>"false"</js> (default)
550    * </ul>
551    *
552    * <h5 class='section'>Notes:</h5><ul>
553    *    <li class='note'>
554    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
555    * </ul>
556    *
557    * <h5 class='section'>See Also:</h5><ul>
558    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#ignoreInvocationExceptionsOnSetters()}
559    * </ul>
560    *
561    * @return The annotation value.
562    */
563   String ignoreInvocationExceptionsOnSetters() default "";
564
565   /**
566    * Ignore unknown properties.
567    *
568    * <p>
569    * If <js>"true"</js>, trying to set a value on a non-existent bean property will silently be ignored.
570    * <br>Otherwise, a {@code RuntimeException} is thrown.
571    *
572    * <ul class='values'>
573    *    <li><js>"true"</js>
574    *    <li><js>"false"</js> (default)
575    * </ul>
576    *
577    * <h5 class='section'>Notes:</h5><ul>
578    *    <li class='note'>
579    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
580    * </ul>
581    *
582    * <h5 class='section'>See Also:</h5><ul>
583    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#ignoreUnknownBeanProperties()}
584    * </ul>
585    *
586    * @return The annotation value.
587    */
588   String ignoreUnknownBeanProperties() default "";
589
590   /**
591    * Ignore unknown enum values.
592    *
593    * <p>
594    * If <js>"true"</js>, unknown enum values are set to <jk>null</jk> instead of throwing an exception.
595    *
596    * <ul class='values'>
597    *    <li><js>"true"</js>
598    *    <li><js>"false"</js> (default)
599    * </ul>
600    *
601    * <h5 class='section'>Notes:</h5><ul>
602    *    <li class='note'>
603    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
604    * </ul>
605    *
606    * <h5 class='section'>See Also:</h5><ul>
607    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#ignoreUnknownEnumValues()}
608    * </ul>
609    *
610    * @return The annotation value.
611    */
612   String ignoreUnknownEnumValues() default "";
613
614   /**
615    * Identifies a set of interfaces.
616    *
617    * <p>
618    * When specified, only the list of properties defined on the interface class will be used during serialization
619    * of implementation classes.  Additional properties on subclasses will be ignored.
620    *
621    * <p class='bjava'>
622    *    <jc>// Parent class or interface</jc>
623    *    <jk>public abstract class</jk> A {
624    *       <jk>public</jk> String <jf>foo</jf> = <js>"foo"</js>;
625    *    }
626    *
627    *    <jc>// Sub class</jc>
628    *    <jk>public class</jk> A1 <jk>extends</jk> A {
629    *       <jk>public</jk> String <jf>bar</jf> = <js>"bar"</js>;
630    *    }
631    *
632    *    <jc>// Apply it to a config</jc>
633    *    <ja>@BeanConfig</ja>(
634    *       interfaces={
635    *          A.<jk>class</jk>
636    *       }
637    *    )
638    * </p>
639    *
640    * <p>
641    * This annotation can be used on the parent class so that it filters to all child classes, or can be set
642    * individually on the child classes.
643    *
644    * <h5 class='section'>Notes:</h5><ul>
645    *    <li class='note'>The {@link Bean#interfaceClass() @Bean(interfaceClass)} annotation is the equivalent annotation-based solution.
646    * </ul>
647    *
648    * @return The annotation value.
649    */
650   Class<?>[] interfaces() default {};
651
652   /**
653    * Locale.
654    *
655    * <p>
656    * Specifies the default locale for serializer and parser sessions.
657    *
658    * <h5 class='section'>Notes:</h5><ul>
659    *    <li class='note'>
660    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
661    * </ul>
662    *
663    * <h5 class='section'>See Also:</h5><ul>
664    *    <li class='jm'>{@link org.apache.juneau.BeanSession.Builder#locale(Locale)}
665    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#locale(Locale)}
666    * </ul>
667    *
668    * @return The annotation value.
669    */
670   String locale() default "";
671
672   /**
673    * Media type.
674    *
675    * <p>
676    * Specifies the default media type value for serializer and parser sessions.
677    *
678    * <h5 class='section'>Notes:</h5><ul>
679    *    <li class='note'>
680    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
681    * </ul>
682    *
683    * <h5 class='section'>See Also:</h5><ul>
684    *    <li class='jm'>{@link org.apache.juneau.BeanSession.Builder#mediaType(MediaType)}
685    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#mediaType(MediaType)}
686    * </ul>
687    *
688    * @return The annotation value.
689    */
690   String mediaType() default "";
691
692   /**
693    * Bean class exclusions.
694    *
695    * <p>
696    * List of classes that should not be treated as beans even if they appear to be bean-like.
697    * <br>Not-bean classes are converted to <c>Strings</c> during serialization.
698    *
699    * <h5 class='section'>Notes:</h5><ul>
700    *    <li class='note'>
701    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
702    * </ul>
703    *
704    * <h5 class='section'>See Also:</h5><ul>
705    *    <li class='ja'>{@link BeanIgnore}
706    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#notBeanClasses(Class...)}
707    * </ul>
708    *
709    * @return The annotation value.
710    */
711   Class<?>[] notBeanClasses() default {};
712
713   /**
714    * Replace classes that should not be considered beans.
715    *
716    * <p>
717    * Same as {@link #notBeanClasses()} but replaces any existing value.
718    *
719    * <h5 class='section'>See Also:</h5><ul>
720    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#notBeanClasses(Class...)}
721    * </ul>
722    *
723    * @return The annotation value.
724    */
725   Class<?>[] notBeanClasses_replace() default {};
726
727   /**
728    * Bean package exclusions.
729    *
730    * <p>
731    * When specified, the current list of ignore packages are appended to.
732    *
733    * <p>
734    * Any classes within these packages will be serialized to strings using {@link Object#toString()}.
735    *
736    * <p>
737    * Note that you can specify suffix patterns to include all subpackages.
738    *
739    * <h5 class='section'>Notes:</h5><ul>
740    *    <li class='note'>
741    *       The default value excludes the following packages:
742    *       <ul class='compact'>
743    *          <li class='jp'><c>java.lang</c>
744    *          <li class='jp'><c>java.lang.annotation</c>
745    *          <li class='jp'><c>java.lang.ref</c>
746    *          <li class='jp'><c>java.lang.reflect</c>
747    *          <li class='jp'><c>java.io</c>
748    *          <li class='jp'><c>java.net</c>
749    *          <li class='jp'><c>java.nio.*</c>
750    *          <li class='jp'><c>java.util.*</c>
751    *       </ul>
752    *    <li class='note'>
753    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
754    * </ul>
755    *
756    * <h5 class='section'>See Also:</h5><ul>
757    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#notBeanPackages(String...)}
758    * </ul>
759    *
760    * @return The annotation value.
761    */
762   String[] notBeanPackages() default {};
763
764   /**
765    * Replace packages whose classes should not be considered beans.
766    *
767    * <p>
768    * Same as {@link #notBeanPackages()} but replaces any existing value.
769    *
770    * <h5 class='section'>See Also:</h5><ul>
771    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#notBeanPackages(String...)}
772    * </ul>
773    *
774    * @return The annotation value.
775    */
776   String[] notBeanPackages_replace() default {};
777
778   /**
779    * Bean property namer.
780    *
781    * <p>
782    * The class to use for calculating bean property names.
783    *
784    * <p>
785    * Predefined classes:
786    * <ul>
787    *    <li>{@link BasicPropertyNamer} (default)
788    *    <li>{@link PropertyNamerDLC} - Dashed-lower-case names.
789    *    <li>{@link PropertyNamerULC} - Dashed-upper-case names.
790    * </ul>
791    *
792    * <h5 class='section'>See Also:</h5><ul>
793    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#propertyNamer(Class)}
794    * </ul>
795    *
796    * @return The annotation value.
797    */
798   Class<? extends PropertyNamer> propertyNamer() default PropertyNamer.Void.class;
799
800   /**
801    * Optional rank for this config.
802    *
803    * <p>
804    * Can be used to override default ordering and application of config annotations.
805    *
806    * @return The annotation value.
807    */
808   int rank() default 0;
809
810   /**
811    * Sort bean properties.
812    *
813    * <p>
814    * When <jk>true</jk>, all bean properties will be serialized and access in alphabetical order.
815    * <br>Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
816    * <br>On IBM JVMs, the bean properties are ordered based on their ordering in the Java file.
817    * <br>On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs).
818    *
819    * <p>
820    * This property is disabled by default so that IBM JVM users don't have to use {@link Bean @Bean} annotations
821    * to force bean properties to be in a particular order and can just alter the order of the fields/methods
822    * in the Java file.
823    *
824    * <ul class='values'>
825    *    <li><js>"true"</js>
826    *    <li><js>"false"</js> (default)
827    * </ul>
828    *
829    * <h5 class='section'>Notes:</h5><ul>
830    *    <li>
831    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
832    * </ul>
833    *
834    * <h5 class='section'>See Also:</h5><ul>
835    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#sortProperties()}
836    * </ul>
837    *
838    * @return The annotation value.
839    */
840   String sortProperties() default "";
841
842   /**
843    * Java object swaps.
844    *
845    * <p>
846    * Swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization,
847    * and "swap in" the non-serializable class during parsing.
848    *
849    * <p>
850    * An example of a swap would be a <c>Calendar</c> object that gets swapped out for an ISO8601 string.
851    *
852    * <p>
853    * Multiple swaps can be associated with a single class.
854    * <br>When multiple swaps are applicable to the same class, the media type pattern defined by
855    * {@link ObjectSwap#forMediaTypes()} or {@link Swap#mediaTypes() @Swap(mediaTypes)} are used to come up with the best match.
856    *
857    * <h5 class='section'>See Also:</h5><ul>
858    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#swaps(Class...)}
859    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SwapBasics">Swap Basics</a>
860    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/PerMediaTypeSwaps">Per-media-type Swaps</a>
861    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/OneWaySwaps">One-way Swaps</a>
862    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SwapAnnotation">@Swap Annotation</a>
863    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/AutoSwaps">Auto-detected swaps</a>
864    *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SurrogateClasses">Surrogate Classes</a>
865    * </ul>
866    *
867    * @return The annotation value.
868    */
869   Class<?>[] swaps() default {};
870
871   /**
872    * Replace Java object swap classes.
873    *
874    * <p>
875    * Same as {@link #swaps()} but replaces any existing value.
876    *
877    * <h5 class='section'>See Also:</h5><ul>
878    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#swaps(Class...)}
879    * </ul>
880    *
881    * @return The annotation value.
882    */
883   Class<?>[] swaps_replace() default {};
884
885   /**
886    * Time zone.
887    *
888    * <p>
889    * Specifies the default timezone for serializer and parser sessions.
890    *
891    * <h5 class='section'>Notes:</h5><ul>
892    *    <li class='note'>
893    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
894    * </ul>
895    *
896    * <h5 class='section'>See Also:</h5><ul>
897    *    <li class='jm'>{@link org.apache.juneau.BeanSession.Builder#timeZone(TimeZone)}
898    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#timeZone(TimeZone)}
899    * </ul>
900    *
901    * @return The annotation value.
902    */
903   String timeZone() default "";
904
905   /**
906    * Bean type property name.
907    *
908    * <p>
909    * This specifies the name of the bean property used to store the dictionary name of a bean type so that the
910    * parser knows the data type to reconstruct.
911    *
912    * <h5 class='section'>Notes:</h5><ul>
913    *    <li class='note'>
914    *       Default value: <js>"_type"</js>.
915    *    <li class='note'>
916    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
917    * </ul>
918   
919    * <h5 class='section'>See Also:</h5><ul>
920    *    <li class='ja'>{@link Bean#typePropertyName()}
921    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#typePropertyName(String)}
922    * </ul>
923    *
924    * @return The annotation value.
925    */
926   String typePropertyName() default "";
927
928   /**
929    * Use enum names.
930    *
931    * <p>
932    * When enabled, enums are always serialized by name, not using {@link Object#toString()}.
933    *
934    * <ul class='values'>
935    *    <li><js>"true"</js>
936    *    <li><js>"false"</js> (default)
937    * </ul>
938    *
939    * <h5 class='section'>Notes:</h5><ul>
940    *    <li class='note'>
941    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
942    * </ul>
943    *
944    * <h5 class='section'>See Also:</h5><ul>
945    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#useEnumNames()}
946    * </ul>
947    *
948    * @return The annotation value.
949    */
950   String useEnumNames() default "";
951
952   /**
953    * Use Java Introspector.
954    *
955    * <p>
956    * Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
957    * <br>Most {@link Bean @Bean} annotations will be ignored.
958    *
959    * <ul class='values'>
960    *    <li><js>"true"</js>
961    *    <li><js>"false"</js> (default)
962    * </ul>
963    *
964    * <h5 class='section'>Notes:</h5><ul>
965    *    <li class='note'>
966    *       Supports <a class="doclink" href="https://juneau.apache.org/docs/topics/DefaultVarResolver">VarResolver.DEFAULT</a> (e.g. <js>"$C{myConfigVar}"</js>).
967    * </ul>
968    *
969    * <h5 class='section'>See Also:</h5><ul>
970    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#useJavaBeanIntrospector()}
971    * </ul>
972    *
973    * @return The annotation value.
974    */
975   String useJavaBeanIntrospector() default "";
976}