|
7 | 7 |
|
8 | 8 | /**
|
9 | 9 | * Indicates that the annotated element should be post-processed. This
|
10 |
| - * annotation can be applied to fields and methods. |
| 10 | + * annotation can be applied to configuration elements and methods. |
11 | 11 | * <p>
|
12 |
| - * Applying this annotation to a field of a configuration class does not cause |
13 |
| - * any post-processing to be triggered automatically. However, both, the |
14 |
| - * presence of this annotation and the return value of its {@link #key()} |
15 |
| - * method can be used as a filter criterion when adding post-processors via a |
16 |
| - * {@code ConfigurationProperties} object. |
| 12 | + * Applying this annotation to configuration elements allows filtering these |
| 13 | + * elements easily via {@code ConfigurationElementFilter.byPostProcessKey}. |
| 14 | + * There mere presence of this annotation on a configuration element, however, |
| 15 | + * does not cause any post-processing to be triggered automatically. |
17 | 16 | * <p>
|
18 |
| - * When applied to a (non-static) method of a configuration type, the method is |
19 |
| - * called immediately after a configuration instance of that type has been |
20 |
| - * initialized. If the return type of the annotated method equals the |
21 |
| - * configuration type, the instance is replaced by the return value of that |
22 |
| - * method call. If the return type is {@code void}, then the method is simply |
23 |
| - * called on the given instance. |
| 17 | + * Applying this annotation to some (non-static/abstract) method of a |
| 18 | + * configuration type, results in that method being called after a configuration |
| 19 | + * instance of that type has been initialized. If the return type of the |
| 20 | + * annotated method is 'void', then the method is simply called. If the return |
| 21 | + * type equals the configuration type, the instance is replaced by the return |
| 22 | + * value of that method call. |
| 23 | + * |
| 24 | + * @see ConfigurationElementFilter#byPostProcessKey(String) |
| 25 | + * @see ConfigurationProperties.Builder#addPostProcessor |
24 | 26 | */
|
25 | 27 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.RECORD_COMPONENT})
|
26 | 28 | @Retention(RetentionPolicy.RUNTIME)
|
27 | 29 | public @interface PostProcess {
|
| 30 | + /** |
| 31 | + * Returns some key that can be used for filtering configuration elements. |
| 32 | + * <p> |
| 33 | + * Specifying a key if this annotation is used on a method currently has no |
| 34 | + * effect but may be changed in the future. |
| 35 | + * |
| 36 | + * @return some arbitrary (developer-chosen) value |
| 37 | + */ |
28 | 38 | String key() default "";
|
29 | 39 | }
|
0 commit comments