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.annotation; 014 015import static java.lang.annotation.ElementType.*; 016import static java.lang.annotation.RetentionPolicy.*; 017 018import java.io.*; 019import java.lang.annotation.*; 020import java.lang.reflect.*; 021 022import org.apache.juneau.*; 023import org.apache.juneau.parser.*; 024import org.apache.juneau.serializer.*; 025import org.apache.juneau.transform.*; 026 027/** 028 * Annotation for specifying config properties defined in {@link BeanContext} and {@link BeanTraverseContext}. 029 * 030 * <p> 031 * Used primarily for specifying bean configuration properties on REST classes and methods. 032 */ 033@Documented 034@Target({TYPE,METHOD}) 035@Retention(RUNTIME) 036@Inherited 037@PropertyStoreApply(BeanConfigApply.class) 038public @interface BeanConfig { 039 040 /** 041 * Optional rank for this config. 042 * 043 * <p> 044 * Can be used to override default ordering and application of config annotations. 045 */ 046 int rank() default 0; 047 048 //----------------------------------------------------------------------------------------------------------------- 049 // BeanContext 050 //----------------------------------------------------------------------------------------------------------------- 051 052 /** 053 * Dynamically applies {@link Bean @Bean} annotations to specified classes. 054 * 055 * <p> 056 * Provides an alternate approach for applying annotations using {@link Bean#on() @Bean.on} to specify the names 057 * to apply the annotation to. 058 * 059 * <ul class='seealso'> 060 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 061 * </ul> 062 */ 063 Bean[] applyBean() default {}; 064 065 /** 066 * Dynamically applies {@link Beanc @Beanc} annotations to specified constructors. 067 * 068 * <p> 069 * Provides an alternate approach for applying annotations using {@link Beanc#on() @Beanc.on} to specify the names 070 * to apply the annotation to. 071 * 072 * <ul class='seealso'> 073 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 074 * </ul> 075 */ 076 Beanc[] applyBeanc() default {}; 077 078 /** 079 * Dynamically applies {@link Beanp @Beanp} annotations to specified methods. 080 * 081 * <p> 082 * Provides an alternate approach for applying annotations using {@link Beanp#on() @Beanp.on} to specify the names 083 * to apply the annotation to. 084 * 085 * <ul class='seealso'> 086 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 087 * </ul> 088 */ 089 Beanp[] applyBeanp() default {}; 090 091 /** 092 * Dynamically applies {@link BeanIgnore @BeanIgnore} annotations to specified classes/methods/fields/constructors. 093 * 094 * <p> 095 * Provides an alternate approach for applying annotations using {@link BeanIgnore#on() @BeanIgnore.on} to specify the names 096 * to apply the annotation to. 097 * 098 * <ul class='seealso'> 099 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 100 * </ul> 101 */ 102 BeanIgnore[] applyBeanIgnore() default {}; 103 104 /** 105 * Dynamically applies {@link Example @Example} annotations to specified classes/methods/fields. 106 * 107 * <p> 108 * Provides an alternate approach for applying annotations using {@link Example#on() @Example.on} to specify the names 109 * to apply the annotation to. 110 * 111 * <ul class='seealso'> 112 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 113 * </ul> 114 */ 115 Example[] applyExample() default {}; 116 117 /** 118 * Dynamically applies {@link NameProperty @NameProperty} annotations to specified methods/fields. 119 * 120 * <p> 121 * Provides an alternate approach for applying annotations using {@link NameProperty#on() @NameProperty.on} to specify the names 122 * to apply the annotation to. 123 * 124 * <ul class='seealso'> 125 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 126 * </ul> 127 */ 128 NameProperty[] applyNameProperty() default {}; 129 130 /** 131 * Dynamically applies {@link ParentProperty @ParentProperty} annotations to specified methods/fields. 132 * 133 * <p> 134 * Provides an alternate approach for applying annotations using {@link ParentProperty#on() @ParentProperty.on} to specify the names 135 * to apply the annotation to. 136 * 137 * <ul class='seealso'> 138 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 139 * </ul> 140 */ 141 ParentProperty[] applyParentProperty() default {}; 142 143 /** 144 * Dynamically applies {@link Swap @Swap} annotations to specified classes/methods/fields. 145 * 146 * <p> 147 * Provides an alternate approach for applying annotations using {@link Swap#on() @Swap.on} to specify the names 148 * to apply the annotation to. 149 * 150 * <ul class='seealso'> 151 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 152 * </ul> 153 */ 154 Swap[] applySwap() default {}; 155 156 /** 157 * Dynamically applies {@link URI @URI} annotations to specified classes/methods/fields. 158 * 159 * <p> 160 * Provides an alternate approach for applying annotations using {@link URI#on() @URI.on} to specify the names 161 * to apply the annotation to. 162 * 163 * <ul class='seealso'> 164 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 165 * </ul> 166 */ 167 URI[] applyURI() default {}; 168 169 /** 170 * Configuration property: Minimum bean class visibility. 171 * 172 * <p> 173 * Classes are not considered beans unless they meet the minimum visibility requirements. 174 * 175 * <p> 176 * For example, if the visibility is <c>PUBLIC</c> and the bean class is <jk>protected</jk>, then the class 177 * will not be interpreted as a bean class and be serialized as a string. 178 * <br>Use this setting to reduce the visibility requirement. 179 * 180 * <ul class='notes'> 181 * <li> 182 * Possible values: 183 * <ul> 184 * <li><js>"PUBLIC"</js> (default) 185 * <li><js>"PROTECTED"</js> 186 * <li><js>"DEFAULT"</js> 187 * <li><js>"PRIVATE"</js> 188 * </ul> 189 * <li> 190 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 191 * </ul> 192 * 193 * <ul class='seealso'> 194 * <li class='jf'>{@link BeanContext#BEAN_beanClassVisibility} 195 * </ul> 196 */ 197 String beanClassVisibility() default ""; 198 199 /** 200 * Configuration property: Minimum bean constructor visibility. 201 * 202 * <p> 203 * Only look for constructors with the specified minimum visibility. 204 * 205 * <p> 206 * This setting affects the logic for finding no-arg constructors for bean. 207 * <br>Normally, only <jk>public</jk> no-arg constructors are used. 208 * <br>Use this setting if you want to reduce the visibility requirement. 209 * 210 * <ul class='notes'> 211 * <li> 212 * Possible values: 213 * <ul> 214 * <li><js>"PUBLIC"</js> (default) 215 * <li><js>"PROTECTED"</js> 216 * <li><js>"DEFAULT"</js> 217 * <li><js>"PRIVATE"</js> 218 * </ul> 219 * <li> 220 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 221 * </ul> 222 * 223 * <ul class='seealso'> 224 * <li class='jf'>{@link BeanContext#BEAN_beanConstructorVisibility} 225 * </ul> 226 */ 227 String beanConstructorVisibility() default ""; 228 229 /** 230 * Configuration property: Bean dictionary. 231 * 232 * <p> 233 * The list of classes that make up the bean dictionary in this bean context. 234 * 235 * <p> 236 * A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred 237 * through reflection. 238 * <br>The names are defined through the {@link Bean#typeName() @Bean(typeName)} annotation defined on the bean class. 239 * <br>For example, if a class <c>Foo</c> has a type-name of <js>"myfoo"</js>, then it would end up serialized 240 * as <js>"{_type:'myfoo',...}"</js>. 241 * 242 * <p> 243 * This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes. 244 * 245 * <ul class='seealso'> 246 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary} 247 * <li class='link'>{@doc juneau-marshall.BeanDictionaries} 248 * </ul> 249 * 250 * <div class='warn'> 251 * <b>Deprecated</b> - {@link #dictionary()}. 252 * </div> 253 */ 254 @Deprecated 255 Class<?>[] beanDictionary() default {}; 256 257 /** 258 * Configuration property: Add to bean dictionary. 259 * 260 * <ul class='seealso'> 261 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary} 262 * </ul> 263 * 264 * <div class='warn'> 265 * <b>Deprecated</b> - {@link #dictionary_replace()}. 266 * </div> 267 */ 268 @Deprecated 269 Class<?>[] beanDictionary_replace() default {}; 270 271 /** 272 * Configuration property: Remove from bean dictionary. 273 * 274 * <ul class='seealso'> 275 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary_remove} 276 * </ul> 277 * 278 * <div class='warn'> 279 * <b>Deprecated</b> - {@link #dictionary_remove()}. 280 * </div> 281 */ 282 @Deprecated 283 Class<?>[] beanDictionary_remove() default {}; 284 285 /** 286 * Configuration property: Minimum bean field visibility. 287 * 288 * <p> 289 * Only look for bean fields with the specified minimum visibility. 290 * 291 * <p> 292 * This affects which fields on a bean class are considered bean properties. 293 * <br>Normally only <jk>public</jk> fields are considered. 294 * <br>Use this setting if you want to reduce the visibility requirement. 295 * 296 * <ul class='notes'> 297 * <li> 298 * Possible values: 299 * <ul> 300 * <li><js>"PUBLIC"</js> (default) 301 * <li><js>"PROTECTED"</js> 302 * <li><js>"DEFAULT"</js> 303 * <li><js>"PRIVATE"</js> 304 * </ul> 305 * <li> 306 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 307 * </ul> 308 * 309 * <ul class='seealso'> 310 * <li class='jf'>{@link BeanContext#BEAN_beanFieldVisibility} 311 * </ul> 312 */ 313 String beanFieldVisibility() default ""; 314 315 /** 316 * Configuration property: Bean filters. 317 * 318 * <p> 319 * This is a programmatic equivalent to the {@link Bean @Bean} annotation. 320 * <br>It's useful when you want to use the <c>@Bean</c> annotation functionality, but you don't have the ability to alter 321 * the bean classes. 322 * 323 * <ul class='notes'> 324 * <li> 325 * Values can consist of any of the following types: 326 * <ul class='spaced-list'> 327 * <li>Any subclass of {@link BeanFilterBuilder}. 328 * <br>These must have a public no-arg constructor. 329 * <li>Any bean interfaces. 330 * <br>A shortcut for defining a {@link InterfaceBeanFilterBuilder}. 331 * <br>Any subclasses of an interface class will only have properties defined on the interface. 332 * <br>All other bean properties will be ignored. 333 * </ul> 334 * </ul> 335 * 336 * <ul class='seealso'> 337 * <li class='jf'>{@link BeanContext#BEAN_beanFilters} 338 * <li class='link'>{@doc juneau-marshall.Transforms.BeanFilters} 339 * <li class='link'>{@doc juneau-marshall.Transforms.InterfaceFilters} 340 * </ul> 341 */ 342 Class<?>[] beanFilters() default {}; 343 344 /** 345 * Configuration property: Add to bean filters. 346 * 347 * <ul class='seealso'> 348 * <li class='jf'>{@link BeanContext#BEAN_beanFilters} 349 * </ul> 350 */ 351 Class<?>[] beanFilters_replace() default {}; 352 353 /** 354 * Configuration property: Remove from bean filters. 355 * 356 * <ul class='seealso'> 357 * <li class='jf'>{@link BeanContext#BEAN_beanFilters_remove} 358 * </ul> 359 */ 360 Class<?>[] beanFilters_remove() default {}; 361 362 /** 363 * Configuration property: BeanMap.put() returns old property value. 364 * 365 * <p> 366 * If <js>"true"</js>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property 367 * values. 368 * <br>Otherwise, it returns <jk>null</jk>. 369 * 370 * <ul class='notes'> 371 * <li> 372 * Possible values: 373 * <ul> 374 * <li><js>"true"</js> 375 * <li><js>"false"</js> (default because it introduces a slight performance penalty during serialization) 376 * </ul> 377 * <li> 378 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 379 * </ul> 380 * 381 * <ul class='seealso'> 382 * <li class='jf'>{@link BeanContext#BEAN_beanMapPutReturnsOldValue} 383 * </ul> 384 */ 385 String beanMapPutReturnsOldValue() default ""; 386 387 /** 388 * Configuration property: Minimum bean method visibility. 389 * 390 * <p> 391 * Only look for bean methods with the specified minimum visibility. 392 * 393 * <p> 394 * This affects which methods are detected as getters and setters on a bean class. 395 * <br>Normally only <jk>public</jk> getters and setters are considered. 396 * <br>Use this setting if you want to reduce the visibility requirement. 397 * 398 * <ul class='notes'> 399 * <li> 400 * Possible values: 401 * <ul> 402 * <li><js>"PUBLIC"</js> (default) 403 * <li><js>"PROTECTED"</js> 404 * <li><js>"DEFAULT"</js> 405 * <li><js>"PRIVATE"</js> 406 * </ul> 407 * <li> 408 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 409 * </ul> 410 * 411 * <ul class='seealso'> 412 * <li class='jf'>{@link BeanContext#BEAN_beanMethodVisibility} 413 * </ul> 414 */ 415 String beanMethodVisibility() default ""; 416 417 /** 418 * Configuration property: Beans require no-arg constructors. 419 * 420 * <p> 421 * If <js>"true"</js>, a Java class must implement a default no-arg constructor to be considered a bean. 422 * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method. 423 * 424 * <ul class='notes'> 425 * <li> 426 * Possible values: 427 * <ul> 428 * <li><js>"true"</js> 429 * <li><js>"false"</js> (default) 430 * </ul> 431 * <li> 432 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 433 * <li> 434 * The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>. 435 * </ul> 436 * 437 * <ul class='seealso'> 438 * <li class='jf'>{@link BeanContext#BEAN_beansRequireDefaultConstructor} 439 * </ul> 440 */ 441 String beansRequireDefaultConstructor() default ""; 442 443 /** 444 * Configuration property: Beans require Serializable interface. 445 * 446 * <p> 447 * If <js>"true"</js>, a Java class must implement the {@link Serializable} interface to be considered a bean. 448 * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method. 449 * 450 * <ul class='notes'> 451 * <li> 452 * Possible values: 453 * <ul> 454 * <li><js>"true"</js> 455 * <li><js>"false"</js> (default) 456 * </ul> 457 * <li> 458 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 459 * <li> 460 * The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>. 461 * </ul> 462 * 463 * <ul class='seealso'> 464 * <li class='jf'>{@link BeanContext#BEAN_beansRequireSerializable} 465 * </ul> 466 */ 467 String beansRequireSerializable() default ""; 468 469 /** 470 * Configuration property: Beans require setters for getters. 471 * 472 * <p> 473 * If <js>"true"</js>, only getters that have equivalent setters will be considered as properties on a bean. 474 * <br>Otherwise, they will be ignored. 475 * 476 * <ul class='notes'> 477 * <li> 478 * Possible values: 479 * <ul> 480 * <li><js>"true"</js> 481 * <li><js>"false"</js> (default) 482 * </ul> 483 * <li> 484 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 485 * </ul> 486 * 487 * <ul class='seealso'> 488 * <li class='jf'>{@link BeanContext#BEAN_beansRequireSettersForGetters} 489 * </ul> 490 */ 491 String beansRequireSettersForGetters() default ""; 492 493 /** 494 * Configuration property: Beans require at least one property. 495 * 496 * <p> 497 * If <js>"true"</js>, then a Java class must contain at least 1 property to be considered a bean. 498 * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method. 499 * 500 * <ul class='notes'> 501 * <li> 502 * Possible values: 503 * <ul> 504 * <li><js>"true"</js> (default) 505 * <li><js>"false"</js> 506 * </ul> 507 * <li> 508 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 509 * </ul> 510 * 511 * <ul class='seealso'> 512 * <li class='jf'>{@link BeanContext#BEAN_beansRequireSomeProperties} 513 * </ul> 514 */ 515 String beansRequireSomeProperties() default ""; 516 517 /** 518 * Configuration property: Bean type property name. 519 * 520 * <p> 521 * This specifies the name of the bean property used to store the dictionary name of a bean type so that the 522 * parser knows the data type to reconstruct. 523 * 524 * <ul class='notes'> 525 * <li> 526 * Default value: <js>"_type"</js>. 527 * <li> 528 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 529 * </ul> 530 531 * <ul class='seealso'> 532 * <li class='jf'>{@link BeanContext#BEAN_beanTypePropertyName} 533 * </ul> 534 */ 535 String beanTypePropertyName() default ""; 536 537 /** 538 * Configuration property: Bean property includes. 539 * 540 * Shortcut for specifying the {@link BeanContext#BEAN_bpi} property on all serializers. 541 * 542 * <p> 543 * The typical use case is when you're rendering summary and details views of the same bean in a resource and 544 * you want to expose or hide specific properties depending on the level of detail you want. 545 * 546 * <p> 547 * In the example below, our 'summary' view is a list of beans where we only want to show the ID property, 548 * and our detail view is a single bean where we want to expose different fields: 549 * <p class='bcode w800'> 550 * <jc>// Our bean</jc> 551 * <jk>public class</jk> MyBean { 552 * 553 * <jc>// Summary properties</jc> 554 * <ja>@Html</ja>(link=<js>"servlet:/mybeans/{id}"</js>) 555 * <jk>public</jk> String <jf>id</jf>; 556 * 557 * <jc>// Detail properties</jc> 558 * <jk>public</jk> String <jf>a</jf>, <jf>b</jf>; 559 * } 560 * 561 * <jc>// Only render "id" property.</jc> 562 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>) 563 * <ja>@BeanConfig</ja>(bpi=<js>"MyBean: id"</js>) 564 * <jk>public</jk> List<MyBean> getBeanSummary() {...} 565 * 566 * <jc>// Only render "a" and "b" properties.</jc> 567 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans/{id}"</js>) 568 * <ja>@BeanConfig</ja>(bpi=<js>"MyBean: a,b"</js>) 569 * <jk>public</jk> MyBean getBeanDetails(<ja>@Path</ja> String id) {...} 570 * </p> 571 * 572 * <ul class='notes'> 573 * <li> 574 * The format of each value is: <js>"Key: comma-delimited-tokens"</js>. 575 * <li> 576 * Keys can be fully-qualified or short class names or <js>"*"</js> to represent all classes. 577 * <li> 578 * Values are comma-delimited lists of bean property names. 579 * <li> 580 * Properties apply to specified class and all subclasses. 581 * <li> 582 * Semicolons can be used as an additional separator for multiple values: 583 * <p class='bcode w800'> 584 * <jc>// Equivalent</jc> 585 * bpi={<js>"Bean1: foo"</js>,<js>"Bean2: bar,baz"</js>} 586 * bpi=<js>"Bean1: foo; Bean2: bar,baz"</js> 587 * </p> 588 * <li> 589 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 590 * </ul> 591 * 592 * <ul class='seealso'> 593 * <li class='jf'>{@link BeanContext#BEAN_bpi} 594 * </ul> 595 */ 596 String[] bpi() default {}; 597 598 /** 599 * Configuration property: Bean property includes. 600 * 601 * <p> 602 * Specifies the set and order of names of properties associated with the bean class. 603 * 604 * <h5 class='section'>Example:</h5> 605 * <p class='bcode w800'> 606 * <ja>@BeanConfig</ja>( 607 * bpiMap={ 608 * <ja>@CS</ja>(key=MyBean.<jk>class</jk>, value=<js>"foo,bar"</js>) 609 * } 610 * ) 611 * <p> 612 * 613 * <ul class='notes'> 614 * <li> 615 * Keys are the class applied to. 616 * <br>Values are comma-delimited lists of property names. 617 * <li> 618 * Setting applies to specified class and all subclasses. 619 * <li> 620 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 621 * </ul> 622 * 623 * <ul class='seealso'> 624 * <li class='jf'>{@link BeanContext#BEAN_bpi} 625 * </ul> 626 */ 627 CS[] bpiMap() default {}; 628 629 /** 630 * Configuration property: Bean property excludes. 631 * 632 * Shortcut for specifying the {@link BeanContext#BEAN_bpx} property on all serializers. 633 * 634 * <p> 635 * Same as {@link #bpi()} except you specify a list of bean property names that you want to exclude from 636 * serialization. 637 * 638 * <p> 639 * In the example below, our 'summary' view is a list of beans where we want to exclude some properties: 640 * <p class='bcode w800'> 641 * <jc>// Our bean</jc> 642 * <jk>public class</jk> MyBean { 643 * 644 * <jc>// Summary properties</jc> 645 * <ja>@Html</ja>(link=<js>"servlet:/mybeans/{id}"</js>) 646 * <jk>public</jk> String <jf>id</jf>; 647 * 648 * <jc>// Detail properties</jc> 649 * <jk>public</jk> String <jf>a</jf>, <jf>b</jf>; 650 * } 651 * 652 * <jc>// Don't show "a" and "b" properties.</jc> 653 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>) 654 * <ja>@BeanConfig</ja>(bpx=<js>"MyBean: a,b"</js>) 655 * <jk>public</jk> List<MyBean> getBeanSummary() {...} 656 * 657 * <jc>// Render all properties.</jc> 658 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans/{id}"</js>) 659 * <jk>public</jk> MyBean getBeanDetails(<ja>@Path</ja> String id) {...} 660 * </p> 661 * 662 * <ul class='notes'> 663 * <li> 664 * The format of each value is: <js>"Key: comma-delimited-tokens"</js>. 665 * <li> 666 * Keys can be fully-qualified or short class names or <js>"*"</js> to represent all classes. 667 * <li> 668 * Values are comma-delimited lists of bean property names. 669 * <li> 670 * Properties apply to specified class and all subclasses. 671 * <li> 672 * Semicolons can be used as an additional separator for multiple values: 673 * <p class='bcode w800'> 674 * <jc>// Equivalent</jc> 675 * bpx={<js>"Bean1: foo"</js>,<js>"Bean2: bar,baz"</js>} 676 * bpx=<js>"Bean1: foo; Bean2: bar,baz"</js> 677 * </p> 678 * <li> 679 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 680 * </ul> 681 * 682 * <ul class='seealso'> 683 * <li class='jf'>{@link BeanContext#BEAN_bpx} 684 * </ul> 685 */ 686 String[] bpx() default {}; 687 688 /** 689 * Configuration property: Bean property excludes. 690 * 691 * <p> 692 * Specifies to exclude the specified list of properties for the specified bean class. 693 * 694 * <h5 class='section'>Example:</h5> 695 * <p class='bcode w800'> 696 * <ja>@BeanConfig</ja>( 697 * bpxMap={ 698 * <ja>@CS</ja>(key=MyBean.<jk>class</jk>, value=<js>"foo,bar"</js>) 699 * } 700 * ) 701 * <p> 702 * 703 * <ul class='notes'> 704 * <li> 705 * Keys are the class applied to. 706 * <br>Values are comma-delimited lists of property names. 707 * <li> 708 * Setting applies to specified class and all subclasses. 709 * <li> 710 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 711 * </ul> 712 * 713 * <ul class='seealso'> 714 * <li class='jf'>{@link BeanContext#BEAN_bpx} 715 * </ul> 716 */ 717 CS[] bpxMap() default {}; 718 719 /** 720 * Configuration property: Read-only bean properties. 721 * 722 * Shortcut for specifying the {@link BeanContext#BEAN_bpro} property on all parsers. 723 * 724 * <p> 725 * Specifies one or more properties on a bean that are read-only despite having valid getters. 726 * Serializers will serialize such properties as usual, but parsers will silently ignore them. 727 * 728 * <h5 class='section'>Example:</h5> 729 * <p class='bcode w800'> 730 * <jc>// Ignore 'a' and 'b' properties if they're present in the HTTP request body.</jc> 731 * <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/mybeans"</js>) 732 * <ja>@BeanConfig</ja>(bpro=<js>"MyBean: a,b"</js>) 733 * <jk>public void</jk> postMyBeans(List<MyBean> l) {...} 734 * </p> 735 * 736 * <ul class='notes'> 737 * <li> 738 * The format of each value is: <js>"Key: comma-delimited-tokens"</js>. 739 * <li> 740 * Keys can be fully-qualified or short class names or <js>"*"</js> to represent all classes. 741 * <li> 742 * Values are comma-delimited lists of bean property names. 743 * <li> 744 * Properties apply to specified class and all subclasses. 745 * <li> 746 * Semicolons can be used as an additional separator for multiple values: 747 * <p class='bcode w800'> 748 * <jc>// Equivalent</jc> 749 * bpro={<js>"Bean1: foo"</js>,<js>"Bean2: bar,baz"</js>} 750 * bpro=<js>"Bean1: foo; Bean2: bar,baz"</js> 751 * </p> 752 * <li> 753 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 754 * </ul> 755 * 756 * <ul class='seealso'> 757 * <li class='jf'>{@link BeanContext#BEAN_bpro} 758 * </ul> 759 */ 760 String[] bpro() default {}; 761 762 /** 763 * Configuration property: Read-only bean properties. 764 * 765 * Shortcut for specifying the {@link BeanContext#BEAN_bpro} property on all parsers. 766 * 767 * <p> 768 * Specifies one or more properties on a bean that are read-only despite having valid getters. 769 * Serializers will serialize such properties as usual, but parsers will silently ignore them. 770 * 771 * <h5 class='section'>Example:</h5> 772 * <p class='bcode w800'> 773 * <jc>// Ignore 'a' and 'b' properties if they're present in the HTTP request body.</jc> 774 * <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/mybeans"</js>) 775 * <ja>@BeanConfig</ja>(bproMap={<ja>@CS</ja>(MyBean.<jk>class</jk>, <js>"a,b"</js>)}) 776 * <jk>public void</jk> postMyBeans(List<MyBean> l) {...} 777 * </p> 778 * 779 * <ul class='notes'> 780 * <li> 781 * Values are comma-delimited lists of bean property names. 782 * <li> 783 * Properties apply to specified class and all subclasses. 784 * <li> 785 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 786 * </ul> 787 * 788 * <ul class='seealso'> 789 * <li class='jf'>{@link BeanContext#BEAN_bpro} 790 * </ul> 791 */ 792 CS[] bproMap() default {}; 793 794 /** 795 * Configuration property: Write-only bean properties. 796 * 797 * Shortcut for specifying the {@link BeanContext#BEAN_bpwo} property on all serializers. 798 * 799 * <p> 800 * Specifies one or more properties on a bean that are write-only despite having valid setters. 801 * Parsers will parse such properties as usual, but serializers will silently ignore them. 802 * 803 * <h5 class='section'>Example:</h5> 804 * <p class='bcode w800'> 805 * <jc>// Ignore 'a' and 'b' properties when serializing the response body.</jc> 806 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>) 807 * <ja>@BeanConfig</ja>(bpwo=<js>"MyBean: a,b"</js>) 808 * <jk>public</jk> List<MyBean> getMyBeans() {...} 809 * </p> 810 * 811 * <ul class='notes'> 812 * <li> 813 * The format of each value is: <js>"Key: comma-delimited-tokens"</js>. 814 * <li> 815 * Keys can be fully-qualified or short class names or <js>"*"</js> to represent all classes. 816 * <li> 817 * Values are comma-delimited lists of bean property names. 818 * <li> 819 * Properties apply to specified class and all subclasses. 820 * <li> 821 * Semicolons can be used as an additional separator for multiple values: 822 * <p class='bcode w800'> 823 * <jc>// Equivalent</jc> 824 * bpwo={<js>"Bean1: foo"</js>,<js>"Bean2: bar,baz"</js>} 825 * bpwo=<js>"Bean1: foo; Bean2: bar,baz"</js> 826 * </p> 827 * <li> 828 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 829 * </ul> 830 * 831 * <ul class='seealso'> 832 * <li class='jf'>{@link BeanContext#BEAN_bpwo} 833 * </ul> 834 */ 835 String[] bpwo() default {}; 836 837 /** 838 * Configuration property: Write-only bean properties. 839 * 840 * Shortcut for specifying the {@link BeanContext#BEAN_bpwo} property on all serializers. 841 * 842 * <p> 843 * Specifies one or more properties on a bean that are write-only despite having valid setters. 844 * Parsers will parse such properties as usual, but serializers will silently ignore them. 845 * 846 * <h5 class='section'>Example:</h5> 847 * <p class='bcode w800'> 848 * <jc>// Ignore 'a' and 'b' properties if they're present in the HTTP request body.</jc> 849 * <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/mybeans"</js>) 850 * <ja>@BeanConfig</ja>(bpwoMap={<ja>@CS</ja>(MyBean.<jk>class</jk>, <js>"a,b"</js>)}) 851 * <jk>public void</jk> List<MyBean> getMyBeans() {...} 852 * </p> 853 * 854 * <ul class='notes'> 855 * <li> 856 * Values are comma-delimited lists of bean property names. 857 * <li> 858 * Properties apply to specified class and all subclasses. 859 * <li> 860 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 861 * </ul> 862 * 863 * <ul class='seealso'> 864 * <li class='jf'>{@link BeanContext#BEAN_bpwo} 865 * </ul> 866 */ 867 CS[] bpwoMap() default {}; 868 869 /** 870 * Configuration property: Debug mode. 871 * 872 * <p> 873 * Enables the following additional information during serialization: 874 * <ul class='spaced-list'> 875 * <li> 876 * When bean getters throws exceptions, the exception includes the object stack information 877 * in order to determine how that method was invoked. 878 * <li> 879 * Enables {@link Serializer#BEANTRAVERSE_detectRecursions}. 880 * </ul> 881 * 882 * <p> 883 * Enables the following additional information during parsing: 884 * <ul class='spaced-list'> 885 * <li> 886 * When bean setters throws exceptions, the exception includes the object stack information 887 * in order to determine how that method was invoked. 888 * </ul> 889 * 890 * <ul class='notes'> 891 * <li> 892 * Possible values: 893 * <ul> 894 * <li><js>"true"</js> 895 * <li><js>"false"</js> (default) 896 * </ul> 897 * <li> 898 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 899 * </ul> 900 * 901 * <ul class='seealso'> 902 * <li class='jf'>{@link BeanContext#BEAN_debug} 903 * </ul> 904 */ 905 String debug() default ""; 906 907 /** 908 * Configuration property: Bean dictionary. 909 * 910 * <p> 911 * The list of classes that make up the bean dictionary in this bean context. 912 * 913 * <p> 914 * A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred 915 * through reflection. 916 * <br>The names are defined through the {@link Bean#typeName() @Bean(typeName)} annotation defined on the bean class. 917 * <br>For example, if a class <c>Foo</c> has a type-name of <js>"myfoo"</js>, then it would end up serialized 918 * as <js>"{_type:'myfoo',...}"</js>. 919 * 920 * <p> 921 * This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes. 922 * 923 * <ul class='seealso'> 924 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary} 925 * <li class='link'>{@doc juneau-marshall.BeanDictionaries} 926 * </ul> 927 */ 928 Class<?>[] dictionary() default {}; 929 930 /** 931 * Configuration property: Add to bean dictionary. 932 * 933 * <ul class='seealso'> 934 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary} 935 * </ul> 936 */ 937 Class<?>[] dictionary_replace() default {}; 938 939 /** 940 * Configuration property: Remove from bean dictionary. 941 * 942 * <ul class='seealso'> 943 * <li class='jf'>{@link BeanContext#BEAN_beanDictionary_remove} 944 * </ul> 945 */ 946 Class<?>[] dictionary_remove() default {}; 947 948 /** 949 * Configuration property: POJO examples. 950 * 951 * <p> 952 * Specifies an example of the specified class. 953 * 954 * <p> 955 * Examples are used in cases such as POJO examples in Swagger documents. 956 * 957 * <h5 class='section'>Example:</h5> 958 * <p class='bcode w800'> 959 * <ja>@BeanConfig</ja>( 960 * examples={ 961 * <ja>@CS</ja>(key=MyBean.<jk>class</jk>, value=<js>"{foo:'bar'}"</js>) 962 * } 963 * ) 964 * </p> 965 * 966 * <ul class='notes'> 967 * <li> 968 * Setting applies to specified class and all subclasses. 969 * <li> 970 * Keys are the class of the example. 971 * <br>Values are Simple-JSON representation of that class. 972 * <li> 973 * POJO examples can also be defined on classes via the following: 974 * <ul class='spaced-list'> 975 * <li>A static field annotated with {@link Example @Example}. 976 * <li>A static method annotated with {@link Example @Example} with zero arguments or one {@link BeanSession} argument. 977 * <li>A static method with name <c>example</c> with no arguments or one {@link BeanSession} argument. 978 * </ul> 979 * <li> 980 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 981 * </ul> 982 * 983 * <ul class='seealso'> 984 * <li class='jf'>{@link BeanContext#BEAN_examples} 985 * </ul> 986 */ 987 CS[] example() default {}; 988 989 /** 990 * Configuration property: POJO examples. 991 * 992 * <p> 993 * Same as {@link #example()} but allows you to define examples as a Simple-JSON string. 994 * 995 * <h5 class='section'>Example:</h5> 996 * <p class='bcode w800'> 997 * <ja>@BeanConfig</ja>( 998 * examples={ 999 * <js>"MyBean: {foo:'bar'}"</js> <jc>// Could also be "{MyBean: {foo:'bar'}}"</jc> 1000 * } 1001 * ) 1002 * </p> 1003 * 1004 * <ul class='notes'> 1005 * <li> 1006 * Keys are the class of the example and can be the fully-qualified name or simple name. 1007 * <br>Values are Simple-JSON representation of that class. 1008 * <li> 1009 * The individual strings are concatenated together and the whole string is treated as a JSON Object. 1010 * <br>The leading and trailing <js>'{'</js> and <js>'}'</js> characters are optional. 1011 * <li> 1012 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1013 * </ul> 1014 * 1015 * <ul class='seealso'> 1016 * <li class='jf'>{@link BeanContext#BEAN_examples} 1017 * </ul> 1018 */ 1019 String[] examples() default {}; 1020 1021 /** 1022 * Configuration property: Bean property excludes. 1023 * 1024 * <div class='warn'> 1025 * <b>Deprecated</b> - {@link #bpxMap()}. 1026 * </div> 1027 */ 1028 @Deprecated CS[] excludeProperties() default {}; 1029 1030 /** 1031 * Configuration property: Find fluent setters. 1032 * 1033 * <p> 1034 * When enabled, fluent setters are detected on beans. 1035 * 1036 * <p> 1037 * Fluent setters must have the following attributes: 1038 * <ul> 1039 * <li>Public. 1040 * <li>Not static. 1041 * <li>Take in one parameter. 1042 * <li>Return the bean itself. 1043 * </ul> 1044 * 1045 * <ul class='notes'> 1046 * <li> 1047 * Possible values: 1048 * <ul> 1049 * <li><js>"true"</js> 1050 * <li><js>"false"</js> (default) 1051 * </ul> 1052 * <li> 1053 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1054 * </ul> 1055 * 1056 * <ul class='seealso'> 1057 * <li class='jf'>{@link BeanContext#BEAN_fluentSetters} 1058 * </ul> 1059 */ 1060 String fluentSetters() default ""; 1061 1062 /** 1063 * Configuration property: Ignore invocation errors on getters. 1064 * 1065 * <p> 1066 * If <js>"true"</js>, errors thrown when calling bean getter methods will silently be ignored. 1067 * <br>Otherwise, a {@code BeanRuntimeException} is thrown. 1068 * 1069 * <ul class='notes'> 1070 * <li> 1071 * Possible values: 1072 * <ul> 1073 * <li><js>"true"</js> 1074 * <li><js>"false"</js> (default) 1075 * </ul> 1076 * <li> 1077 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1078 * </ul> 1079 * 1080 * <ul class='seealso'> 1081 * <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnGetters} 1082 * </ul> 1083 */ 1084 String ignoreInvocationExceptionsOnGetters() default ""; 1085 1086 /** 1087 * Configuration property: Ignore invocation errors on setters. 1088 * 1089 * <p> 1090 * If <js>"true"</js>, errors thrown when calling bean setter methods will silently be ignored. 1091 * <br>Otherwise, a {@code BeanRuntimeException} is thrown. 1092 * 1093 * <ul class='notes'> 1094 * <li> 1095 * Possible values: 1096 * <ul> 1097 * <li><js>"true"</js> 1098 * <li><js>"false"</js> (default) 1099 * </ul> 1100 * <li> 1101 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1102 * </ul> 1103 * 1104 * <ul class='seealso'> 1105 * <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnSetters} 1106 * </ul> 1107 */ 1108 String ignoreInvocationExceptionsOnSetters() default ""; 1109 1110 /** 1111 * Configuration property: Ignore properties without setters. 1112 * 1113 * <p> 1114 * If <js>"true"</js>, trying to set a value on a bean property without a setter will silently be ignored. 1115 * <br>Otherwise, a {@code RuntimeException} is thrown. 1116 * 1117 * <ul class='notes'> 1118 * <li> 1119 * Possible values: 1120 * <ul> 1121 * <li><js>"true"</js> (default) 1122 * <li><js>"false"</js> 1123 * </ul> 1124 * <li> 1125 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1126 * </ul> 1127 * 1128 * <ul class='seealso'> 1129 * <li class='jf'>{@link BeanContext#BEAN_ignorePropertiesWithoutSetters} 1130 * </ul> 1131 */ 1132 String ignorePropertiesWithoutSetters() default ""; 1133 1134 /** 1135 * Configuration property: Ignore unknown properties. 1136 * 1137 * <p> 1138 * If <js>"true"</js>, trying to set a value on a non-existent bean property will silently be ignored. 1139 * <br>Otherwise, a {@code RuntimeException} is thrown. 1140 * 1141 * <ul class='notes'> 1142 * <li> 1143 * Possible values: 1144 * <ul> 1145 * <li><js>"true"</js> 1146 * <li><js>"false"</js> (default) 1147 * </ul> 1148 * <li> 1149 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1150 * </ul> 1151 * 1152 * <ul class='seealso'> 1153 * <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownBeanProperties} 1154 * </ul> 1155 */ 1156 String ignoreUnknownBeanProperties() default ""; 1157 1158 /** 1159 * Configuration property: Ignore unknown properties with null values. 1160 * 1161 * <p> 1162 * If <js>"true"</js>, trying to set a <jk>null</jk> value on a non-existent bean property will silently be ignored. 1163 * <br>Otherwise, a {@code RuntimeException} is thrown. 1164 * 1165 * <ul class='notes'> 1166 * <li> 1167 * Possible values: 1168 * <ul> 1169 * <li><js>"true"</js> (default) 1170 * <li><js>"false"</js> 1171 * </ul> 1172 * <li> 1173 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1174 * </ul> 1175 * 1176 * <ul class='seealso'> 1177 * <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownNullBeanProperties} 1178 * </ul> 1179 */ 1180 String ignoreUnknownNullBeanProperties() default ""; 1181 1182 /** 1183 * Configuration property: Implementation classes. 1184 * 1185 * <p> 1186 * For interfaces and abstract classes this method can be used to specify an implementation class for the 1187 * interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a 1188 * parse). 1189 * 1190 * <h5 class='section'>Example:</h5> 1191 * <p class='bcode w800'> 1192 * <ja>@BeanConfig</ja>( 1193 * implClasses={ 1194 * <ja>@CC</ja>(key=MyInterface.<jk>class</jk>, value=MyInterfaceImpl.<jk>class</jk>) 1195 * } 1196 * ) 1197 * <p> 1198 * 1199 * <ul class='seealso'> 1200 * <li class='jf'>{@link BeanContext#BEAN_implClasses} 1201 * </ul> 1202 */ 1203 CC[] implClasses() default {}; 1204 1205 /** 1206 * Configuration property: Bean property includes. 1207 * 1208 * <div class='warn'> 1209 * <b>Deprecated</b> - {@link #bpiMap()}. 1210 * </div> 1211 */ 1212 @Deprecated CS[] includeProperties() default {}; 1213 1214 /** 1215 * Configuration property: Locale. 1216 * 1217 * <p> 1218 * Specifies the default locale for serializer and parser sessions. 1219 * 1220 * <ul class='notes'> 1221 * <li> 1222 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1223 * </ul> 1224 * 1225 * <ul class='seealso'> 1226 * <li class='jf'>{@link BeanContext#BEAN_locale} 1227 * </ul> 1228 */ 1229 String locale() default ""; 1230 1231 /** 1232 * Configuration property: Media type. 1233 * 1234 * <p> 1235 * Specifies the default media type value for serializer and parser sessions. 1236 * 1237 * <ul class='notes'> 1238 * <li> 1239 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1240 * </ul> 1241 * 1242 * <ul class='seealso'> 1243 * <li class='jf'>{@link BeanContext#BEAN_mediaType} 1244 * </ul> 1245 */ 1246 String mediaType() default ""; 1247 1248 /** 1249 * Configuration property: Bean class exclusions. 1250 * 1251 * <p> 1252 * List of classes that should not be treated as beans even if they appear to be bean-like. 1253 * <br>Not-bean classes are converted to <c>Strings</c> during serialization. 1254 * 1255 * <ul class='notes'> 1256 * <li> 1257 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1258 * </ul> 1259 * 1260 * <ul class='seealso'> 1261 * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses} 1262 * </ul> 1263 */ 1264 Class<?>[] notBeanClasses() default {}; 1265 1266 /** 1267 * Configuration property: Add to classes that should not be considered beans. 1268 * 1269 * <ul class='seealso'> 1270 * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses} 1271 * </ul> 1272 */ 1273 Class<?>[] notBeanClasses_replace() default {}; 1274 1275 /** 1276 * Configuration property: Remove from classes that should not be considered beans. 1277 * 1278 * <ul class='seealso'> 1279 * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses} 1280 * </ul> 1281 */ 1282 Class<?>[] notBeanClasses_remove() default {}; 1283 1284 /** 1285 * Configuration property: Bean package exclusions. 1286 * 1287 * <p> 1288 * When specified, the current list of ignore packages are appended to. 1289 * 1290 * <p> 1291 * Any classes within these packages will be serialized to strings using {@link Object#toString()}. 1292 * 1293 * <p> 1294 * Note that you can specify suffix patterns to include all subpackages. 1295 * 1296 * <ul class='notes'> 1297 * <li> 1298 * The default value excludes the following packages: 1299 * <ul> 1300 * <li><c>java.lang</c> 1301 * <li><c>java.lang.annotation</c> 1302 * <li><c>java.lang.ref</c> 1303 * <li><c>java.lang.reflect</c> 1304 * <li><c>java.io</c> 1305 * <li><c>java.net</c> 1306 * <li><c>java.nio.*</c> 1307 * <li><c>java.util.*</c> 1308 * </ul> 1309 * <li> 1310 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1311 * </ul> 1312 * 1313 * <ul class='seealso'> 1314 * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages} 1315 * </ul> 1316 */ 1317 String[] notBeanPackages() default {}; 1318 1319 /** 1320 * Configuration property: Add to packages whose classes should not be considered beans. 1321 * 1322 * <ul class='seealso'> 1323 * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages} 1324 * </ul> 1325 */ 1326 String[] notBeanPackages_replace() default {}; 1327 1328 /** 1329 * Configuration property: Remove from packages whose classes should not be considered beans. 1330 * 1331 * <ul class='seealso'> 1332 * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages} 1333 * </ul> 1334 */ 1335 String[] notBeanPackages_remove() default {}; 1336 1337 /** 1338 * Configuration property: POJO swaps. 1339 * 1340 * <p> 1341 * POJO swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization, 1342 * and "swap in" the non-serializable class during parsing. 1343 * 1344 * <p> 1345 * An example of a POJO swap would be a <c>Calendar</c> object that gets swapped out for an ISO8601 string. 1346 * 1347 * <p> 1348 * Multiple POJO swaps can be associated with a single class. 1349 * <br>When multiple swaps are applicable to the same class, the media type pattern defined by 1350 * {@link PojoSwap#forMediaTypes()} or {@link Swap#mediaTypes() @Swap(mediaTypes)} are used to come up with the best match. 1351 * 1352 * <ul class='seealso'> 1353 * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps} 1354 * <li class='link'>{@doc juneau-marshall.Transforms.PojoSwaps} 1355 * <li class='link'>{@doc juneau-marshall.Transforms.PerMediaTypePojoSwaps} 1356 * <li class='link'>{@doc juneau-marshall.Transforms.OneWayPojoSwaps} 1357 * <li class='link'>{@doc juneau-marshall.Transforms.SwapAnnotation} 1358 * <li class='link'>{@doc juneau-marshall.Transforms.AutoPojoSwaps} 1359 * <li class='link'>{@doc juneau-marshall.Transforms.SurrogateClasses} 1360 * </ul> 1361 */ 1362 Class<? extends PojoSwap<?,?>>[] pojoSwaps() default {}; 1363 1364 /** 1365 * Configuration property: Add to POJO swap classes. 1366 * 1367 * <ul class='seealso'> 1368 * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps} 1369 * </ul> 1370 */ 1371 Class<? extends PojoSwap<?,?>>[] pojoSwaps_replace() default {}; 1372 1373 /** 1374 * Configuration property: Remove from POJO swap classes. 1375 * 1376 * <ul class='seealso'> 1377 * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps} 1378 * </ul> 1379 */ 1380 Class<? extends PojoSwap<?,?>>[] pojoSwaps_remove() default {}; 1381 1382 /** 1383 * Configuration property: Bean property namer. 1384 * 1385 * <p> 1386 * The class to use for calculating bean property names. 1387 * 1388 * <p> 1389 * Predefined classes: 1390 * <ul> 1391 * <li>{@link PropertyNamerDefault} (default) 1392 * <li>{@link PropertyNamerDLC} - Dashed-lower-case names. 1393 * <li>{@link PropertyNamerULC} - Dashed-upper-case names. 1394 * </ul> 1395 * 1396 * <ul class='seealso'> 1397 * <li class='jf'>{@link BeanContext#BEAN_propertyNamer} 1398 * </ul> 1399 */ 1400 Class<? extends PropertyNamer> propertyNamer() default PropertyNamer.Null.class; 1401 1402 /** 1403 * Configuration property: Sort bean properties. 1404 * 1405 * <p> 1406 * When <jk>true</jk>, all bean properties will be serialized and access in alphabetical order. 1407 * <br>Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor. 1408 * <br>On IBM JVMs, the bean properties are ordered based on their ordering in the Java file. 1409 * <br>On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs). 1410 * 1411 * <p> 1412 * This property is disabled by default so that IBM JVM users don't have to use {@link Bean @Bean} annotations 1413 * to force bean properties to be in a particular order and can just alter the order of the fields/methods 1414 * in the Java file. 1415 * 1416 * <ul class='notes'> 1417 * <li> 1418 * Possible values: 1419 * <ul> 1420 * <li><js>"true"</js> 1421 * <li><js>"false"</js> (default) 1422 * </ul> 1423 * <li> 1424 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1425 * </ul> 1426 * 1427 * <ul class='seealso'> 1428 * <li class='jf'>{@link BeanContext#BEAN_sortProperties} 1429 * </ul> 1430 */ 1431 String sortProperties() default ""; 1432 1433 /** 1434 * Configuration property: Time zone. 1435 * 1436 * <p> 1437 * Specifies the default timezone for serializer and parser sessions. 1438 * 1439 * <ul class='notes'> 1440 * <li> 1441 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1442 * </ul> 1443 * 1444 * <ul class='seealso'> 1445 * <li class='jf'>{@link BeanContext#BEAN_timeZone} 1446 * </ul> 1447 */ 1448 String timeZone() default ""; 1449 1450 /** 1451 * Configuration property: Use enum names. 1452 * 1453 * <p> 1454 * When enabled, enums are always serialized by name, not using {@link Object#toString()}. 1455 * 1456 * <ul class='notes'> 1457 * <li> 1458 * Possible values: 1459 * <ul> 1460 * <li><js>"true"</js> 1461 * <li><js>"false"</js> (default) 1462 * </ul> 1463 * <li> 1464 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1465 * </ul> 1466 * 1467 * <ul class='seealso'> 1468 * <li class='jf'>{@link BeanContext#BEAN_useEnumNames} 1469 * </ul> 1470 */ 1471 String useEnumNames() default ""; 1472 1473 /** 1474 * Configuration property: Use interface proxies. 1475 * 1476 * <p> 1477 * If <js>"true"</js>, then interfaces will be instantiated as proxy classes through the use of an 1478 * {@link InvocationHandler} if there is no other way of instantiating them. 1479 * <br>Otherwise, throws a {@link BeanRuntimeException}. 1480 * 1481 * <ul class='notes'> 1482 * <li> 1483 * Possible values: 1484 * <ul> 1485 * <li><js>"true"</js> (default) 1486 * <li><js>"false"</js> 1487 * </ul> 1488 * <li> 1489 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1490 * </ul> 1491 * 1492 * <ul class='seealso'> 1493 * <li class='jf'>{@link BeanContext#BEAN_useInterfaceProxies} 1494 * </ul> 1495 */ 1496 String useInterfaceProxies() default ""; 1497 1498 /** 1499 * Configuration property: Use Java Introspector. 1500 * 1501 * <p> 1502 * Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters. 1503 * <br>Most {@link Bean @Bean} annotations will be ignored. 1504 * 1505 * <ul class='notes'> 1506 * <li> 1507 * Possible values: 1508 * <ul> 1509 * <li><js>"true"</js> 1510 * <li><js>"false"</js> (default) 1511 * </ul> 1512 * <li> 1513 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1514 * </ul> 1515 * 1516 * <ul class='seealso'> 1517 * <li class='jf'>{@link BeanContext#BEAN_useJavaBeanIntrospector} 1518 * </ul> 1519 */ 1520 String useJavaBeanIntrospector() default ""; 1521 1522 //----------------------------------------------------------------------------------------------------------------- 1523 // BeanTraverseContext 1524 //----------------------------------------------------------------------------------------------------------------- 1525 1526 /** 1527 * Configuration property: Automatically detect POJO recursions. 1528 * 1529 * <p> 1530 * Specifies that recursions should be checked for during traversal. 1531 * 1532 * <p> 1533 * Recursions can occur when traversing models that aren't true trees but rather contain loops. 1534 * <br>In general, unchecked recursions cause stack-overflow-errors. 1535 * <br>These show up as {@link ParseException ParseExceptions} with the message <js>"Depth too deep. Stack overflow occurred."</js>. 1536 * 1537 * <p> 1538 * The behavior when recursions are detected depends on the value for {@link BeanTraverseContext#BEANTRAVERSE_ignoreRecursions}. 1539 * 1540 * <p> 1541 * For example, if a model contains the links A->B->C->A, then the JSON generated will look like 1542 * the following when <jsf>BEANTRAVERSE_ignoreRecursions</jsf> is <jk>true</jk>... 1543 * 1544 * <p class='bcode w800'> 1545 * {A:{B:{C:<jk>null</jk>}}} 1546 * </p> 1547 * 1548 * <ul class='notes'> 1549 * <li> 1550 * Checking for recursion can cause a small performance penalty. 1551 * <li> 1552 * Possible values: 1553 * <ul> 1554 * <li><js>"true"</js> 1555 * <li><js>"false"</js> (default) 1556 * </ul> 1557 * <li> 1558 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1559 * </ul> 1560 * 1561 * <ul class='seealso'> 1562 * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_detectRecursions} 1563 * </ul> 1564 */ 1565 String detectRecursions() default ""; 1566 1567 /** 1568 * Configuration property: Ignore recursion errors. 1569 * 1570 * <p> 1571 * Used in conjunction with {@link BeanTraverseContext#BEANTRAVERSE_detectRecursions}. 1572 * <br>Setting is ignored if <jsf>BEANTRAVERSE_detectRecursions</jsf> is <js>"false"</js>. 1573 * 1574 * <p> 1575 * If <js>"true"</js>, when we encounter the same object when traversing a tree, we set the value to <jk>null</jk>. 1576 * <br>Otherwise, a {@link BeanRecursionException} is thrown with the message <js>"Recursion occurred, stack=..."</js>. 1577 * 1578 * <ul class='notes'> 1579 * <li> 1580 * Possible values: 1581 * <ul> 1582 * <li><js>"true"</js> 1583 * <li><js>"false"</js> (default) 1584 * </ul> 1585 * <li> 1586 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1587 * </ul> 1588 * 1589 * <ul class='seealso'> 1590 * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_ignoreRecursions} 1591 * </ul> 1592 */ 1593 String ignoreRecursions() default ""; 1594 1595 /** 1596 * Configuration property: Initial depth. 1597 * 1598 * <p> 1599 * The initial indentation level at the root. 1600 * <br>Useful when constructing document fragments that need to be indented at a certain level. 1601 * 1602 * <ul class='notes'> 1603 * <li> 1604 * Format: integer 1605 * <li> 1606 * Default value: <js>"0"</js> 1607 * <li> 1608 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1609 * </ul> 1610 * 1611 * <ul class='seealso'> 1612 * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_initialDepth} 1613 * </ul> 1614 */ 1615 String initialDepth() default ""; 1616 1617 /** 1618 * Configuration property: Max traversal depth. 1619 * 1620 * <p> 1621 * Abort traversal if specified depth is reached in the POJO tree. 1622 * <br>If this depth is exceeded, an exception is thrown. 1623 * 1624 * <ul class='notes'> 1625 * <li> 1626 * Format: integer 1627 * <li> 1628 * Default value: <js>"100"</js> 1629 * <li> 1630 * Supports {@doc DefaultSvlVariables} (e.g. <js>"$C{myConfigVar}"</js>). 1631 * </ul> 1632 * 1633 * <ul class='seealso'> 1634 * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_maxDepth} 1635 * </ul> 1636 */ 1637 String maxDepth() default ""; 1638}