Skip to content

Commit

Permalink
Implement #32
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 10, 2014
1 parent 304f57b commit d9f31b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -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)

------------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
*/
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
Expand Down Expand Up @@ -59,6 +68,16 @@
*/
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.
Expand Down

0 comments on commit d9f31b7

Please sign in to comment.