diff --git a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc index 58cf8ca3a..c39addf90 100644 --- a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc +++ b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc @@ -366,7 +366,7 @@ public class CarMapperImpl implements CarMapper { if ( car.getCategory() != null ) { carDto.setCategory( car.getCategory().toString() ); } - carDto.setEngine( engineTtoEngineDto( car.getEngine() ) ); + carDto.setEngine( engineToEngineDto( car.getEngine() ) ); return carDto; } @@ -408,7 +408,7 @@ MapStruct takes all public properties of the source and target types into accoun [[adding-custom-methods]] === Adding custom methods to mappers -In some cases it can be required to manually implement a specific mapping from one type to another which can't be generated by MapStruct. One way for this is to implement such method on another class which then is used by mappers generated by MapStruct (see <>). +In some cases it can be required to manually implement a specific mapping from one type to another which can't be generated by MapStruct. One way to handle this is to implement the custom method on another class which then is used by mappers generated by MapStruct (see <>). Alternatively, when using Java 8 or later, you can implement custom methods directly in a mapper interface as default methods. The generated code will invoke the default methods if the argument and return types match. @@ -434,7 +434,7 @@ public interface CarMapper { The class generated by MapStruct implements the method `carToCarDto()`. The generated code in `carToCarDto()` will invoke the manually implemented `personToPersonDto()` method when mapping the `driver` attribute. -A mapper could also be defined in form of an abstract class instead of an interface and implement custom methods directly in this mapper class. In this case MapStruct will generate an extension of the abstract class with implementations of all abstract methods. An advantage of this approach over declaring default methods is that additional fields could be declared in the mapper class. +A mapper could also be defined in the form of an abstract class instead of an interface and implement the custom methods directly in the mapper class. In this case MapStruct will generate an extension of the abstract class with implementations of all abstract methods. An advantage of this approach over declaring default methods is that additional fields could be declared in the mapper class. The previous example where the mapping from `Person` to `PersonDto` requires some special logic could then be defined like this: