Skip to content

Commit b4cfad2

Browse files
committed
Merge branch '2.20' into 2.x
2 parents 8ce07ad + 940b596 commit b4cfad2

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/main/java/com/fasterxml/jackson/annotation/JsonInclude.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Annotation used to indicate when value of the annotated property (when
1010
* 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.
1212
* Without annotation property values are always included, but by using
1313
* this annotation one can specify simple exclusion rules to reduce
1414
* amount of properties to write out.
@@ -19,29 +19,35 @@
1919
* it is possible that JSON null values are output, if object reference
2020
* in question is not `null`. An example is {@link java.util.concurrent.atomic.AtomicReference}
2121
* 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.
2323
*<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
2526
* to specify {@link #content()} annotation; for example, specifying only
2627
* {@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:
3033
*<pre>
3134
*public class Bean {
3235
* {@literal @JsonInclude}(value=Include.NON_EMPTY, content=Include.NON_NULL)
3336
* public Map&lt;String,String&gt; entries;
3437
*}
3538
*</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
3844
* {@link Include#NON_DEFAULT} for more details).
3945
*<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
4147
* 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).
4551
*
4652
* @since 2.0
4753
*/

0 commit comments

Comments
 (0)