[jackson-annotations] 174/207: Implement #32
Timo Aaltonen
tjaalton at moszumanska.debian.org
Sat Sep 6 13:55:52 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 d9f31b7fcf2bac68db3e9050ca73452a4e6ac89a
Author: Tatu Saloranta <tatu.saloranta at iki.fi>
Date: Wed Apr 9 19:23:11 2014 -0700
Implement #32
---
release-notes/VERSION | 1 +
.../fasterxml/jackson/annotation/JsonProperty.java | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/release-notes/VERSION b/release-notes/VERSION
index 3e64d17..c80ac0c 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -5,6 +5,7 @@ NOTE: Annotations module will never contain changes in patch versions,
only .0 releases can have changes.
#31: Allow use of `@JsonPropertyOrder` for properties (not just classes)
+#32: Add `@JsonProperty.index`
- Add `JsonFormat.Value#timeZoneAsString` (needed by Joda module)
------------------------------------------------------------------------
diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
index 242c7b7..ce3d336 100644
--- a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
+++ b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
@@ -32,6 +32,15 @@ public @interface JsonProperty
public final static String USE_DEFAULT_NAME = "";
/**
+ * Marker value used to indicate that no index has been specified.
+ * Used as the default value as annotations do not allow "missing"
+ * values.
+ *
+ * @since 2.4
+ */
+ public final static int INDEX_UNKNOWN = -1;
+
+ /**
* Defines name of the logical property, i.e. JSON object field
* name to use for the property. If value is empty String (which is the
* default), will try to use name of the field that is annotated.
@@ -59,6 +68,16 @@ public @interface JsonProperty
*/
boolean required() default false;
+ /**
+ * Property that indicates numerical index of this property (relative
+ * to other properties specified for the Object). This index
+ * is typically used by binary formats, but may also be useful
+ * for schema languages and other tools.
+ *
+ * @since 2.4
+ */
+ int index() default INDEX_UNKNOWN;
+
/* 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.
--
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