Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
24 lines
880 B
Plaintext
24 lines
880 B
Plaintext
== 1. Basic mapping: id and username by name, email -> emailAddress by configuration
|
|
ID: 1
|
|
User: ankurm
|
|
Email: [email protected]
|
|
|
|
== 2. Nested object: no configuration at all
|
|
profile class: ProfileEntity
|
|
first name: John
|
|
|
|
== 3. Collection: List<String> -> List<TagEntity> through the custom converter
|
|
Java
|
|
Spring Boot
|
|
Dozer
|
|
|
|
== 4. Bidirectional: the same configuration maps the entity back
|
|
round trip equals original: true
|
|
UserDTO[id=1, username=ankurm, [email protected], profile=ProfileDTO[John Doe], tags=[Java, Spring Boot, Dozer, MapStruct, JMH]]
|
|
|
|
== 5. Null handling: default Dozer copies null over an existing value
|
|
after mapping a DTO with null email and null profile: emailAddress=null, profile=null
|
|
|
|
== 6. Null handling: TypeMappingOptions.mapNull(false) keeps the existing value
|
|
after the same update: [email protected], profile=ProfileEntity[John Doe]
|