File tree 2 files changed +40
-0
lines changed
src/main/java/com/fasterxml/jackson/annotation
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ NOTE: Annotations module will never contain changes in patch versions,
15
15
16
16
#56: Improve `ObjectIdGenerators.key()` to handle `null` appropriately by returning `null`
17
17
#58: Add new properties for `@JsonIgnoreProperties`, "allowGetters", "allowSetters"
18
+ #60: Add new value type, `Nullean`, for "nullable booleans", to support proper handling
19
+ and usage of default values, not just explicit true/false.
18
20
- Add `JsonInclude.Include.NON_ABSENT` value, for excluding "absent" Optional values.
19
21
20
22
2.5.0 (01-Jan-2015)
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .annotation ;
2
+
3
+ /**
4
+ * Nullable Boolean value, "nullean". Needed just because Java annotations
5
+ * can not take 'null' as a value (even as default), so there is no
6
+ * way to distinguish between explicit `true` and `false`, and lack of
7
+ * choice (related: annotations are limited to primitives, so
8
+ * {@link java.lang.Boolean} not allowed as solution).
9
+ *<p>
10
+ * Note: although use of `true` and `false` would be more convenient, they
11
+ * can not be chosen since they are Java keyword and compiler won't allow
12
+ * the choice. And since enum naming convention suggests all-upper-case,
13
+ * that is what is done here.
14
+ *
15
+ * @since 2.6
16
+ */
17
+ public enum Nullean
18
+ {
19
+ /**
20
+ * Value that indicates that the annotation property is explicitly defined to
21
+ * be enabled, or true.
22
+ */
23
+ TRUE ,
24
+
25
+ /**
26
+ * Value that indicates that the annotation property is explicitly defined to
27
+ * be disabled, or false.
28
+ */
29
+ FALSE ,
30
+
31
+ /**
32
+ * Value that indicates that the annotation property does NOT have an explicit
33
+ * definition of enabled/disabled (or true/false); instead, a higher-level
34
+ * configuration value is used; or lacking higher-level global setting,
35
+ * default.
36
+ */
37
+ DEFAULT ;
38
+ }
You can’t perform that action at this time.
0 commit comments