Skip to content

bhf/st-learning-java-mapstruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StayTuned

st-learning-mapstruct

Gradle (Kotlin DSL) Java project demonstrating various MapStruct patterns and recipes with JUnit5.

Examples

Basic

Simple mapping between PersonEntity and PersonDTO using MapStruct.

Record Example

Mapping to a Java record-based DTO (PersonDTO is a record).

Enum Example

Demonstrates mapping between different enum types (external -> domain).

Source Property Example:

Source object uses property-style accessors (firstName() / firstName(String)), target DTO uses standard getters/setters.

Target Property Example

Source object uses standard getters/setters, target DTO uses property-style accessors (demonstrates @AfterMapping usage).

Iterable Example

Source entity has an Iterable<Item> field where Item exposes property-style accessors; the DTO uses a List<ItemDTO> field. Demonstrates mapping from an Iterable source to a List target and element mapping.

Running Tests

Build, run the sample applications, or run tests with the Gradle wrapper:

# Run the test suite
./gradlew test

About

st-learning: Mapstruct Patterns, Recipes and Examples

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages