Examples for using MapStruct
Java Kotlin
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
mapstruct-field-mapping Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-iterable-to-non-iterable Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-jpa-child-parent Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-kotlin Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-lombok Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-lookup-entity-with-id Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-mapping-from-map Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-mapping-with-cycles Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-nested-bean-mappings Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-on-ant Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-on-gradle Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-protobuf3 Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-rounding Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-spi-accessor-naming Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
mapstruct-updatemethods-1 Update examples to use latest 1.3.0.Beta1 Jul 15, 2018
.gitattributes Initializing example repo Jul 7, 2013
.gitignore example on SPI Aug 29, 2016
.travis.yml Add Travis CI support (#44) Jul 15, 2018
README.md lookup-entity-with-id Mar 17, 2018
license.txt Update copyright headers to 2017 Feb 6, 2017
pom.xml lookup-entity-with-id Mar 17, 2018

README.md

MapStruct Examples

This repository contains examples showing how to use MapStruct, a Java annotation processor for the generation of type-safe bean mapping classes.

Currently, the following examples exist:

  • mapstruct-on-ant: Shows how to use MapStruct in Ant-based projects; to build this example, run ant build on the command line
  • mapstruct-on-gradle: Shows how to use MapStruct in Gradle-based projects; to build the example project, run ./gradlew clean build on the command line
  • mapstruct-lombok: Shows how to use MapStruct together with Lombok (with both a Maven pom.xml and a Gradle build.gradle); to build the example project, run either mvn clean install or ./gradlew clean build on the command line
  • mapstruct-iterable-non-iterable: Shows how by means of a mapper util class conversions can be made from an iterable- to its non-iterable element
  • mapstruct-mapping-from-map: Shows how by means of a mapper util class and qualifiers extracting value can be carried out on Maps. Watch mapstruct/mapstruct#1075 for native support.
  • mapstruct-rounding: Shows how by means of a mapper util class and qualifiers roundings can be carried out on Numbers
  • mapstruct-examples-updatemethods-1: Shows how to update an existing target object
  • mapstruct-examples-field-mapping: Shows how MapStruct can be used with "struct" like objects with public fields
  • mapstruct-nested-bean-mappings: Shows how to map object graphs via a main root method
  • mapstruct-mapping-with-cycles: Shows how to map object graphs that can contain cycles
  • mapstruct-spi-accessor-naming: Example on how to use the Service Provider Interface (SPI) for a custom accessor naming strategy.
  • mapstruct-protobuf3: Example on how to use protobuf3 with MapStruct
  • mapstruct-kotlin: Example on how to use MapStruct with Kotlin using KAPT (Kotlin Annotation Processing Tool)
  • mapstruct-jpa-parent-child: Example on how to use @Context in relation to parent / child relations in JPA)
  • mapstruct-lookup-entity-with-composed-key: Shows how an object with composite key can be read from the database in a mapping method.

License

The examples in this project are licensed under the Apache License, Version 2.0.