diff --git a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc index 211ee8e46..e8cb50032 100644 --- a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc +++ b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc @@ -328,7 +328,7 @@ The general philosophy of MapStruct is to generate code which looks as much as p As the example shows the generated code takes into account any name mappings specified via `@Mapping`. If the type of a mapped attribute is different in source and target entity, MapStruct will either apply an automatic conversion (as e.g. for the _price_ property, see also <>) or optionally invoke another mapping method (as e.g. for the _driver_ property, see also <>). -Collection-typed attributes with the same element type will be copied by creating a new instance of the target collection type containing the elements from the source property. For collection-typed attributes with different element types each element will mapped individually and added to the target collection (see <>). +Collection-typed attributes with the same element type will be copied by creating a new instance of the target collection type containing the elements from the source property. For collection-typed attributes with different element types each element will be mapped individually and added to the target collection (see <>). MapStruct takes all public properties of the source and target types into account. This includes properties declared on super-types. @@ -550,7 +550,7 @@ MapStruct takes care of type conversions automatically in many cases. If for ins Currently the following conversions are applied automatically: -* Between all Java primitive data types and their corresponding wrapper types, e.g. between `int` and `Integer`, `boolean` and `Boolean` etc. The generated code is `null` aware, i.e. when converting a wrapper type into the corresponding primitive type a `null` check will performed. +* Between all Java primitive data types and their corresponding wrapper types, e.g. between `int` and `Integer`, `boolean` and `Boolean` etc. The generated code is `null` aware, i.e. when converting a wrapper type into the corresponding primitive type a `null` check will be performed. * Between all Java primitive number types and the wrapper types, e.g. between `int` and `long` or `byte` and `Integer`. @@ -641,7 +641,7 @@ public interface CarMapper { * Between `java.sql.Timestamp` and `java.util.Date` -* When converting from a `String`, omitting `Mapping#dateFormat` results in using the default pattern and date format symbols for the default locale. An exception to this rule is `XmlGregorianCalendar` which results in parsing the `String` according to http://www.w3.org/TR/xmlschema-2/#dateTime[XML Schema 1.0 Part 2, Section 3.2.7-14.1, Lexical Representation]. +* When converting from a `String`, omitting `Mapping#dateFormat`, it leads to usage of the default pattern and date format symbols for the default locale. An exception to this rule is `XmlGregorianCalendar` which results in parsing the `String` according to http://www.w3.org/TR/xmlschema-2/#dateTime[XML Schema 1.0 Part 2, Section 3.2.7-14.1, Lexical Representation]. [[mapping-object-references]] === Mapping object references @@ -679,7 +679,7 @@ When generating the implementation of a mapping method, MapStruct will apply the [[invoking-other-mappers]] === Invoking other mappers -In addition to methods defined on the same mapper type MapStruct can also invoke mapping methods defined in other classes, be it mappers generated by MapStruct or hand-written mapping methods. This can be useful to structure your mapping code in several classes (e.g. with on mapper type per application module) or you want to provide custom mapping logic which can't be generated by MapStruct. +In addition to methods defined on the same mapper type MapStruct can also invoke mapping methods defined in other classes, be it mappers generated by MapStruct or hand-written mapping methods. This can be useful to structure your mapping code in several classes (e.g. with one mapper type per application module) or if you want to provide custom mapping logic which can't be generated by MapStruct. For instance the `Car` class might contain an attribute `manufacturingDate` while the corresponding DTO attribute is of type String. In order to map this attribute, you could implement a mapper class like this: @@ -1457,7 +1457,7 @@ public interface SourceTargetMapper { @Mappings( { @Mapping(target = "stringProperty", source = "stringProp", defaultValue = "undefined"), - @Mapping(target = "longProperty", defaultValue = "-1"), + @Mapping(target = "longProperty", source = "longProp", defaultValue = "-1"), @Mapping(target = "stringConstant", constant = "Constant Value"), @Mapping(target = "integerConstant", constant = "14"), @Mapping(target = "longWrapperConstant", constant = "3001"),