|
8 | 8 | /** |
9 | 9 | * Annotation used to indicate when value of the annotated property (when |
10 | 10 | * used for a field, method or constructor parameter), or all |
11 | | - * properties of the annotated class, is to be serialized. |
| 11 | + * properties of the annotated class (when used for a class), is to be serialized. |
12 | 12 | * Without annotation property values are always included, but by using |
13 | 13 | * this annotation one can specify simple exclusion rules to reduce |
14 | 14 | * amount of properties to write out. |
|
19 | 19 | * it is possible that JSON null values are output, if object reference |
20 | 20 | * in question is not `null`. An example is {@link java.util.concurrent.atomic.AtomicReference} |
21 | 21 | * instance constructed to reference <code>null</code> value: such a value |
22 | | - * would be serialized as JSON null, and not filtered out. |
| 22 | + * would be serialized as JSON {@code null}, and not filtered out. |
23 | 23 | *<p> |
24 | | - * To base inclusion on value of contained value(s), you will typically also need |
| 24 | + * To base inclusion on value of <b>contained</b> value(s) (like {@code java.util.Map} |
| 25 | + * entries), you will typically also need |
25 | 26 | * to specify {@link #content()} annotation; for example, specifying only |
26 | 27 | * {@link #value} as {@link Include#NON_EMPTY} for a {@link java.util.Map} would |
27 | | - * exclude <code>Map</code>s with no values, but would include <code>Map</code>s |
28 | | - * with `null` values. To exclude Map with only `null` value, you would use both |
29 | | - * annotations like so: |
| 28 | + * exclude {@link java.util.Map}s with no entries (empty {@code Map}s), |
| 29 | + * but would include <code>Map</code>s elements with {@code null} values (even |
| 30 | + * though {@code null}s are considered "empty" values). |
| 31 | + * To exclude {@code Map}s with only `null`-valued entries, |
| 32 | + * you would use both annotations like so: |
30 | 33 | *<pre> |
31 | 34 | *public class Bean { |
32 | 35 | * {@literal @JsonInclude}(value=Include.NON_EMPTY, content=Include.NON_NULL) |
33 | 36 | * public Map<String,String> entries; |
34 | 37 | *} |
35 | 38 | *</pre> |
36 | | - * Similarly you could exclude <code>Map</code>s that only contain |
37 | | - * "empty" elements, or "non-default" values (see {@link Include#NON_EMPTY} and |
| 39 | + * (in which case filtering first excludes {@code Map} entries with {@code null} values |
| 40 | + * and then excludes {@code Map}s that have no entries left). |
| 41 | + * <br> |
| 42 | + * Similarly you could exclude <code>Map</code>s map entries with |
| 43 | + * "empty" values, or "non-default" values (see {@link Include#NON_EMPTY} and |
38 | 44 | * {@link Include#NON_DEFAULT} for more details). |
39 | 45 | *<p> |
40 | | - * In addition to `Map`s, `content` concept is also supported for referential |
| 46 | + * In addition to {@code Map}s, {@code content} concept is also supported for referential |
41 | 47 | * types (like {@link java.util.concurrent.atomic.AtomicReference}). |
42 | | - * Note that `content` is NOT currently (as of Jackson 2.9) supported for |
43 | | - * arrays or {@link java.util.Collection}s, but supported may be added in |
44 | | - * future versions. |
| 48 | + * Note that `content` is NOT currently (as of Jackson 2.20) supported for |
| 49 | + * arrays or {@link java.util.Collection}s; support may be added in |
| 50 | + * future versions (but if so, will be configurable to allow disabling it). |
45 | 51 | * |
46 | 52 | * @since 2.0 |
47 | 53 | */ |
|
0 commit comments