Skip to content

Commit

Permalink
fix #60, Add Nullean value type.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 31, 2015
1 parent 4595936 commit 85f5f0c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION
Expand Up @@ -15,6 +15,8 @@ NOTE: Annotations module will never contain changes in patch versions,

#56: Improve `ObjectIdGenerators.key()` to handle `null` appropriately by returning `null`
#58: Add new properties for `@JsonIgnoreProperties`, "allowGetters", "allowSetters"
#60: Add new value type, `Nullean`, for "nullable booleans", to support proper handling
and usage of default values, not just explicit true/false.
- Add `JsonInclude.Include.NON_ABSENT` value, for excluding "absent" Optional values.

2.5.0 (01-Jan-2015)
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/fasterxml/jackson/annotation/Nullean.java
@@ -0,0 +1,38 @@
package com.fasterxml.jackson.annotation;

/**
* Nullable Boolean value, "nullean". Needed just because Java annotations
* can not take 'null' as a value (even as default), so there is no
* way to distinguish between explicit `true` and `false`, and lack of
* choice (related: annotations are limited to primitives, so
* {@link java.lang.Boolean} not allowed as solution).
*<p>
* Note: although use of `true` and `false` would be more convenient, they
* can not be chosen since they are Java keyword and compiler won't allow
* the choice. And since enum naming convention suggests all-upper-case,
* that is what is done here.
*
* @since 2.6
*/
public enum Nullean
{
/**
* Value that indicates that the annotation property is explicitly defined to
* be enabled, or true.
*/
TRUE,

/**
* Value that indicates that the annotation property is explicitly defined to
* be disabled, or false.
*/
FALSE,

/**
* Value that indicates that the annotation property does NOT have an explicit
* definition of enabled/disabled (or true/false); instead, a higher-level
* configuration value is used; or lacking higher-level global setting,
* default.
*/
DEFAULT;
}

0 comments on commit 85f5f0c

Please sign in to comment.