Skip to content

Commit

Permalink
mapstruct#3504 Add example classes for the passing target type docume…
Browse files Browse the repository at this point in the history
…ntation
  • Loading branch information
filiphr committed Jul 20, 2024
1 parent 66f4288 commit 76118cd
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,39 @@ When having a custom mapper hooked into the generated mapper with `@Mapper#uses(

For instance, the `CarDto` could have a property `owner` of type `Reference` that contains the primary key of a `Person` entity. You could now create a generic custom mapper that resolves any `Reference` objects to their corresponding managed JPA entity instances.

e.g.

.Example classes for the passing target type example
====
[source, java, linenums]
[subs="verbatim,attributes"]
----
public class Car {
private Person owner;
// ...
}
public class Person extends BaseEntity {
// ...
}
public class Reference {
private String pk;
// ...
}
public class CarDto {
private Reference owner;
// ...
}
----
====


.Mapping method expecting mapping target type as parameter
====
[source, java, linenums]
Expand Down

0 comments on commit 76118cd

Please sign in to comment.