[jackson-annotations] 25/207: Add @JsonProperty.required for future extension

Timo Aaltonen tjaalton at moszumanska.debian.org
Sat Sep 6 13:55:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

tjaalton pushed a commit to branch master
in repository jackson-annotations.

commit 4f50a1bbf2f9e7244fd173a1717e888ec15ab765
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date:   Fri Feb 17 22:25:49 2012 -0800

    Add @JsonProperty.required for future extension
---
 .../fasterxml/jackson/annotation/JsonProperty.java | 25 +++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
index d2a0ca6..d256677 100644
--- a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
+++ b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
@@ -16,7 +16,7 @@ import java.lang.annotation.Target;
  * as the property name without any modifications, but it
  * can be specified to non-empty value to specify different
  * name. Property name refers to name used externally, as
- * the field name in Json objects.
+ * the field name in JSON objects.
  */
 @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
 @Retention(RetentionPolicy.RUNTIME)
@@ -29,4 +29,27 @@ public @interface JsonProperty
      * default), will use name of the field that is annotated.
      */
     String value() default "";
+
+    /**
+     * Property that indicates whether a value (which may be explicit
+     * null) is expected for property during deserialization or not.
+     * If expected, <code>BeanDeserialized</code> should indicate
+     * this as a validity problem (usually by throwing an exception,
+     * but this may be sent via problem handlers that can try to
+     * rectify the problem, for example, by supplying a default
+     * value).
+     *<p>
+     * Note that as of 2.0, this property is NOT used by
+     * <code>BeanDeserializer</code>: support is expected to be
+     * added for later minor versions.
+     * 
+     * @since 2.0
+     */
+    boolean required() default false;
+
+    /* NOTE: considering of adding ability to specify default
+     * String value -- would work well for scalar types, most of
+     * which can coerce from Strings. But won't add for 2.0 yet.
+     */
+    //String defaultValue() default "";
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-annotations.git



More information about the pkg-java-commits mailing list