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