Skip to content

Commit d9f31b7

Browse files
committed
Implement #32
1 parent 304f57b commit d9f31b7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

release-notes/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ NOTE: Annotations module will never contain changes in patch versions,
55
only .0 releases can have changes.
66

77
#31: Allow use of `@JsonPropertyOrder` for properties (not just classes)
8+
#32: Add `@JsonProperty.index`
89
- Add `JsonFormat.Value#timeZoneAsString` (needed by Joda module)
910

1011
------------------------------------------------------------------------

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131
*/
3232
public final static String USE_DEFAULT_NAME = "";
3333

34+
/**
35+
* Marker value used to indicate that no index has been specified.
36+
* Used as the default value as annotations do not allow "missing"
37+
* values.
38+
*
39+
* @since 2.4
40+
*/
41+
public final static int INDEX_UNKNOWN = -1;
42+
3443
/**
3544
* Defines name of the logical property, i.e. JSON object field
3645
* name to use for the property. If value is empty String (which is the
@@ -59,6 +68,16 @@
5968
*/
6069
boolean required() default false;
6170

71+
/**
72+
* Property that indicates numerical index of this property (relative
73+
* to other properties specified for the Object). This index
74+
* is typically used by binary formats, but may also be useful
75+
* for schema languages and other tools.
76+
*
77+
* @since 2.4
78+
*/
79+
int index() default INDEX_UNKNOWN;
80+
6281
/* NOTE: considering of adding ability to specify default
6382
* String value -- would work well for scalar types, most of
6483
* which can coerce from Strings. But won't add for 2.0 yet.

0 commit comments

Comments
 (0)