Add `@JsonProperty.defaultValue()`, related to [databind#596]
diff --git a/release-notes/VERSION b/release-notes/VERSION
index b2ef809..c7071b5 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -23,6 +23,7 @@
for `java.util.Map` entries separate from inclusion of `Map` values
themselves
- Finalize fix for [databind#490], by ensuring new mapping initialized for new context
+- Added `@JsonProperty.defaultValue()` (related to [databind#596])
2.4.4 (24-Nov-2014)
2.4.3 (02-Oct-2014)
diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
index ce3d336..bc76175 100644
--- a/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
+++ b/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java
@@ -77,10 +77,16 @@
* @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.
+
+ /**
+ * Property that may be used to <b>document</b> expected default value
+ * for the property: most often used as source information for generating
+ * schemas (like JSON Schema or protobuf/thrift schema), or documentation.
+ * It may also be used by Jackson extension modules; core jackson databind
+ * does not have any automated handling beyond simply exposing this
+ * value through bean property introspection.
+ *
+ * @since 2.5
*/
- //String defaultValue() default "";
+ String defaultValue() default "";
}
diff --git a/src/main/java/com/fasterxml/jackson/annotation/SimpleObjectIdResolver.java b/src/main/java/com/fasterxml/jackson/annotation/SimpleObjectIdResolver.java
index 77b1021..b45f236 100644
--- a/src/main/java/com/fasterxml/jackson/annotation/SimpleObjectIdResolver.java
+++ b/src/main/java/com/fasterxml/jackson/annotation/SimpleObjectIdResolver.java
@@ -11,7 +11,9 @@
* @author Pascal Gélinas
*/
public class SimpleObjectIdResolver implements ObjectIdResolver {
- private Map<IdKey,Object> _items;
+ protected Map<IdKey,Object> _items;
+
+ public SimpleObjectIdResolver() { }
@Override
public void bindItem(IdKey id, Object ob)
@@ -34,7 +36,7 @@
public boolean canUseFor(ObjectIdResolver resolverType) {
return resolverType.getClass() == getClass();
}
-
+
@Override
public ObjectIdResolver newForDeserialization(Object context) {
// 19-Dec-2014, tatu: Important: must re-create without existing mapping; otherwise bindings leak