diff --git a/src/docbkx/reference/mapping.xml b/src/docbkx/reference/mapping.xml
index 8e59ae52d..3e1cdb653 100644
--- a/src/docbkx/reference/mapping.xml
+++ b/src/docbkx/reference/mapping.xml
@@ -369,7 +369,11 @@ public class Person {
Spring Framework . Within the mapping framework it can be applied to
constructor arguments. This lets you use a Spring Expression
Language statement to transform a key's value retrieved in the
- database before it is used to construct a domain object.
+ database before it is used to construct a domain object. In order to
+ reference a property of a given document one has to use expressions
+ like: @Value("#root.myProperty") where
+ root refers to the root of the given
+ document.
@@ -444,7 +448,75 @@ public class Person<T extends Address> {
// other getters/setters ommitted
-
+
+
+
+
+ Customized Object Construction
+
+ The Mapping Subsystem allows the customization of the object
+ construction by annotating a constructor with the
+ @PersistenceConstructor annotation. The values to be
+ used for the constructor parameters are resolved in the following
+ way:
+
+
+
+ If a parameter is annotated with the @Value
+ annotation, the given expression is evaluated and the result is used
+ as the parameter value.
+
+
+
+ If the Java type has a property whose name matches the given
+ field of the input document, then it's property information is used
+ to select the appropriate constructor parameter to pass the input
+ field value to. This works only if the parameter name information is
+ present in the java .class files which can be achieved by compiling
+ the source with debug information or using the new
+ -parameters command-line switch for javac in Java
+ 8.
+
+
+
+ Otherwise an MappingException will be
+ thrown indicating that the given constructor parameter could not be
+ bound.
+
+
+
+ class OrderItem {
+
+ @Id String id;
+ int quantity;
+ double unitPrice;
+
+ OrderItem(String id, @Value("#root.qty ?: 0") int quantity, double unitPrice) {
+ this.id = id;
+ this.quantity = quantity;
+ this.unitPrice = unitPrice;
+ }
+
+ // getters/setters ommitted
+}
+
+DBObject input = new BasicDBObject("id", "4711");
+input.put("unitPrice", 2.5);
+input.put("qty",5);
+OrderItem item = converter.read(OrderItem.class, input);
+
+
+ The SpEL expression in the @Value annotation
+ of the quantity parameter falls back to the value
+ 0 if the given property path cannot be
+ resolved.
+
+
+ Additional examples for using the
+ @PersistenceConstructor annotation can be found
+ in the MappingMongoConverterUnitTests
+ test suite.
@@ -608,7 +680,7 @@ public class Person {
}
-
+