diff --git a/.bazelignore b/.bazelignore
new file mode 100644
index 00000000..a108a019
--- /dev/null
+++ b/.bazelignore
@@ -0,0 +1,4 @@
+mapstruct-on-bazel/bazel-bin
+mapstruct-on-bazel/bazel-out
+mapstruct-on-bazel/bazel-testlogs
+mapstruct-on-bazel/bazel-mapstruct-on-bazel
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..7898f976
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,96 @@
+name: CI
+
+on: [push, pull_request]
+
+env:
+ MAVEN_ARGS: >-
+ -V -B --no-transfer-progress
+ -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
+
+jobs:
+ linux_maven:
+ strategy:
+ fail-fast: false
+ matrix:
+ java: [8, 11, 17, 21]
+ name: 'Linux JDK ${{ matrix.java }} Maven'
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout'
+ uses: actions/checkout@v4
+ - name: 'Set up JDK'
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java }}
+ - name: 'Test'
+ run: ./mvnw ${MAVEN_ARGS} -U clean verify
+ linux_gradle:
+ strategy:
+ fail-fast: false
+ matrix:
+ java: [8, 11, 17, 21]
+ name: 'Linux JDK ${{ matrix.java }} Gradle'
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout'
+ uses: actions/checkout@v4
+ - name: 'Set up JDK'
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java }}
+ - name: 'Test'
+ run: ./gradlew buildAll
+ windows_maven:
+ name: 'Windows'
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: 'Set up JDK 8'
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: 8
+ - name: 'Test'
+ run: ./mvnw ${MAVEN_ARGS} -U clean verify
+ mac_maven:
+ name: 'Mac OS'
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: 'Set up JDK 8'
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: 8
+ - name: 'Test'
+ run: ./mvnw ${MAVEN_ARGS} -U clean verify
+ linux_bazel:
+ strategy:
+ fail-fast: false
+ matrix:
+ java: [11, 17, 21]
+ name: 'Linux JDK ${{ matrix.java }} Bazel'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java }}
+ - name: Setup Bazel
+ uses: bazel-contrib/setup-bazel@0.18.0
+ with:
+ # Avoid downloading Bazel every time.
+ bazelisk-cache: true
+ # Store build cache per workflow.
+ disk-cache: ${{ github.workflow }}
+ # Share repository cache between workflows.
+ repository-cache: true
+ - name: Test
+ run: bazelisk test //...
+ - name: Build
+ run: bazelisk build //...
diff --git a/.gitignore b/.gitignore
index c602080e..6ef8429b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,13 @@
target
test-output
/*/build
+/*/*/build
/*/bin
+/*/out
+/*/*/out
# Gradle
.gradle
+
+# Bazel
+**/bazel-*
\ No newline at end of file
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..8dea6c22
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,3 @@
+wrapperVersion=3.3.4
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 32ae4287..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: java
-
-sudo: false
-dist: trusty
-
-install: true
-
-matrix:
- include:
- - jdk: openjdk8
- - jdk: oraclejdk8
- - jdk: openjdk10
- # For some reason pulling from sonatype_snapshots does not work for openjdk10 and we have to manually symlink
- # See https://github.com/travis-ci/travis-ci/issues/9368#issuecomment-405070163
- before_install:
- - rm "${JAVA_HOME}/lib/security/cacerts"
- - ln -s /etc/ssl/certs/java/cacerts "${JAVA_HOME}/lib/security/cacerts"
- - jdk: openjdk11
- - jdk: openjdk-ea
- allow_failures:
- - jdk: openjdk-ea
-
-script: mvn clean verify -B -V -U
-
-cache:
- directories:
- - $HOME/.m2
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 00000000..098eae1e
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,2 @@
+# Root BUILD file for mapstruct-examples
+# The actual Bazel build is in the mapstruct-on-bazel subdirectory
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 00000000..13954602
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,19 @@
+module(
+ name = "mapstruct-examples",
+ version = "1.0.0",
+)
+
+bazel_dep(name = "rules_java", version = "8.14.0")
+bazel_dep(name = "rules_jvm_external", version = "6.6")
+
+maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
+
+maven.install(
+ artifacts = [
+ "org.mapstruct:mapstruct:1.7.0.Beta1",
+ "org.mapstruct:mapstruct-processor:1.7.0.Beta1",
+ "junit:junit:4.13.2",
+ "org.assertj:assertj-core:3.27.7",
+ ],
+)
+use_repo(maven, "maven")
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock
new file mode 100644
index 00000000..8fb08990
--- /dev/null
+++ b/MODULE.bazel.lock
@@ -0,0 +1,207 @@
+{
+ "lockFileVersion": 24,
+ "registryFileHashes": {
+ "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
+ "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
+ "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915",
+ "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed",
+ "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da",
+ "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
+ "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
+ "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d",
+ "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d",
+ "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a",
+ "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58",
+ "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87",
+ "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc",
+ "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
+ "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953",
+ "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84",
+ "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8",
+ "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb",
+ "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4",
+ "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6",
+ "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4",
+ "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f",
+ "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075",
+ "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d",
+ "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902",
+ "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5",
+ "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f",
+ "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29",
+ "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee",
+ "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37",
+ "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615",
+ "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814",
+ "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d",
+ "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7",
+ "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c",
+ "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d",
+ "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df",
+ "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e",
+ "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981",
+ "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0",
+ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e",
+ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022",
+ "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206",
+ "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4",
+ "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8",
+ "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5",
+ "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513",
+ "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c",
+ "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
+ "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
+ "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e",
+ "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
+ "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86",
+ "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39",
+ "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6",
+ "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31",
+ "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a",
+ "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6",
+ "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab",
+ "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2",
+ "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe",
+ "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615",
+ "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc",
+ "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.6/MODULE.bazel": "153042249c7060536dc95b6bb9f9bb8063b8a0b0cb7acdb381bddbc2374aed55",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.6/source.json": "b1d7ffc3877e5a76e6e48e6bce459cbb1712c90eba14861b112bd299587a534d",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5",
+ "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0",
+ "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d",
+ "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c",
+ "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb",
+ "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc",
+ "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff",
+ "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a",
+ "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
+ "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7",
+ "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73",
+ "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2",
+ "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1",
+ "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
+ "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300",
+ "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382",
+ "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed",
+ "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58",
+ "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c",
+ "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7",
+ "https://bcr.bazel.build/modules/rules_python/0.40.0/source.json": "939d4bd2e3110f27bfb360292986bb79fd8dcefb874358ccd6cdaa7bda029320",
+ "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c",
+ "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b",
+ "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3",
+ "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8",
+ "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c",
+ "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef",
+ "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c",
+ "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7",
+ "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01",
+ "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43",
+ "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0",
+ "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca",
+ "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806",
+ "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198"
+ },
+ "selectedYankedVersions": {},
+ "moduleExtensions": {
+ "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": {
+ "general": {
+ "bzlTransitiveDigest": "rL/34P1aFDq2GqVC2zCFgQ8nTuOC6ziogocpvG50Qz8=",
+ "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=",
+ "recordedFileInputs": {},
+ "recordedDirentsInputs": {},
+ "envVariables": {},
+ "generatedRepoSpecs": {
+ "com_github_jetbrains_kotlin_git": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository",
+ "attributes": {
+ "urls": [
+ "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip"
+ ],
+ "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88"
+ }
+ },
+ "com_github_jetbrains_kotlin": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository",
+ "attributes": {
+ "git_repository_name": "com_github_jetbrains_kotlin_git",
+ "compiler_version": "1.9.23"
+ }
+ },
+ "com_github_google_ksp": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository",
+ "attributes": {
+ "urls": [
+ "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip"
+ ],
+ "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d",
+ "strip_version": "1.9.23-1.0.20"
+ }
+ },
+ "com_github_pinterest_ktlint": {
+ "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file",
+ "attributes": {
+ "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985",
+ "urls": [
+ "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint"
+ ],
+ "executable": true
+ }
+ },
+ "rules_android": {
+ "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive",
+ "attributes": {
+ "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
+ "strip_prefix": "rules_android-0.1.1",
+ "urls": [
+ "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"
+ ]
+ }
+ }
+ },
+ "recordedRepoMappingEntries": [
+ [
+ "rules_kotlin+",
+ "bazel_tools",
+ "bazel_tools"
+ ]
+ ]
+ }
+ }
+ },
+ "facts": {}
+}
diff --git a/README.md b/README.md
index a4c146f5..ec6b2df2 100644
--- a/README.md
+++ b/README.md
@@ -4,21 +4,27 @@ This repository contains examples showing how to use [MapStruct](http://mapstruc
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](https://github.com/mapstruct/mapstruct/issues/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.
+* [_mapstruct-on-ant_](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_](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-on-bazel_](mapstruct-on-bazel): Shows how to use MapStruct in Bazel-based projects; to build the example project, run `bazel build //...` on the command line, to test the project, run `bazel test //...`.
+* [_mapstruct-lombok_](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_](mapstruct-iterable-to-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_](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](https://github.com/mapstruct/mapstruct/issues/1075) for native support.
+* [_mapstruct-rounding_](mapstruct-rounding): Shows how by means of a mapper util class and qualifiers roundings can be carried out on Numbers
+* [_mapstruct-updatemethods_](mapstruct-updatemethods-1): Shows how to update an existing target object
+* [_mapstruct-field-mapping_](mapstruct-field-mapping): Shows how MapStruct can be used with "struct" like objects with public fields
+* [_mapstruct-nested-bean-mappings_](mapstruct-nested-bean-mappings): Shows how to map object graphs via a main root method
+* [_mapstruct-mapping-with-cycles_](mapstruct-nested-bean-mappings): Shows how to map object graphs that can contain cycles
+* [_mapstruct-spi-accessor-naming_](mapstruct-spi-accessor-naming): Example on how to use the Service Provider Interface (SPI) for a custom accessor naming strategy.
+* [_mapstruct-protobuf3_](mapstruct-protobuf3): Example on how to use protobuf3 with MapStruct
+* [_mapstruct-kotlin_](mapstruct-kotlin): Example on how to use MapStruct with Kotlin using KAPT (Kotlin Annotation Processing Tool)
+* [_mapstruct-kotlin-gradle_](mapstruct-kotlin-gradle): Example on how to use MapStruct with Kotlin and Gradle Kotlin DSL using KAPT
+* [_mapstruct-jpa-child-parent_](mapstruct-jpa-child-parent): Example on how to use @Context in relation to parent / child relations in JPA)
+* [_mapstruct-suppress-unmapped_](mapstruct-suppress-unmapped): Shows how mapping to target properties can be ignored without warning by default in a mixed scenario. However bean property mappings that have the same name will still be applied.
+* [_mapstruct-lookup-entity-with-id_](mapstruct-lookup-entity-with-id): Shows how an object with composite key can be read from the database in a mapping method.
+* [_mapstruct-clone_](mapstruct-clone): Shows how an object can be deeply cloned by defining all mapping methods.
+* [_mapstruct-metadata-annotations_](mapstruct-metadata-with-annotations): Demonstrates how to read annotations and use them as mapping instruction.
+* [_mapstruct-mappers-repo_](mapstruct-mapper-repo): Demonstrates how one can build a repo of mappers by means of code generation.
## License
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 00000000..42d95e50
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,2 @@
+# This project has been migrated to Bzlmod (MODULE.bazel)
+# The WORKSPACE file is kept for compatibility but is no longer actively used
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..f59c0a65
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,3 @@
+task buildAll {
+ dependsOn gradle.includedBuilds*.task(':build')
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..e708b1c0
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..db9a6b82
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 00000000..4f906e0c
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 00000000..107acd32
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/license.txt b/license.txt
index f053dd8c..73ce4f8a 100644
--- a/license.txt
+++ b/license.txt
@@ -1,16 +1,3 @@
- Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- and/or other contributors as indicated by the @authors tag. See the
- copyright.txt file in the distribution for a full listing of all
- contributors.
+ Copyright MapStruct Authors.
- The MapStruct Examples project is licensed under the Apache License,
- Version 2.0 (the "License"); you may not use this software except in
- compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
diff --git a/mapstruct-clone/pom.xml b/mapstruct-clone/pom.xml
new file mode 100644
index 00000000..fe7bc83c
--- /dev/null
+++ b/mapstruct-clone/pom.xml
@@ -0,0 +1,66 @@
+
+
+
+ 4.0.0
+
+ org.mapstruct.examples.clone
+ mapstruct-deep-clone
+ 1.0.0
+
+
+ UTF-8
+ 1.7.0.Beta1
+
+
+
+
+ org.mapstruct
+ mapstruct
+ ${org.mapstruct.version}
+
+
+
+ junit
+ junit
+ 4.13.1
+ test
+
+
+
+ org.assertj
+ assertj-core
+ 3.27.7
+ test
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.14.1
+
+ 1.8
+ 1.8
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${org.mapstruct.version}
+
+
+
+
+
+
+
+
diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java
new file mode 100644
index 00000000..3d3386e4
--- /dev/null
+++ b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.mapstruct.example.dto;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class CustomerDto {
+
+ private Long id;
+ private String customerName;
+ private List orders;
+ private Map stock;
+
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public List getOrders() {
+ return orders;
+ }
+
+ public void setOrders(List orders) {
+ this.orders = orders;
+ }
+
+ public Map getStock() {
+ return stock;
+ }
+
+ public void setStock(Map stock) {
+ this.stock = stock;
+ }
+}
diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemDto.java b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemDto.java
new file mode 100644
index 00000000..758c79f2
--- /dev/null
+++ b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemDto.java
@@ -0,0 +1,26 @@
+package org.mapstruct.example.dto;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class OrderItemDto {
+
+ private String name;
+ private Long quantity;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Long getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Long quantity) {
+ this.quantity = quantity;
+ }
+}
diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemKeyDto.java b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemKeyDto.java
new file mode 100644
index 00000000..1fd800a1
--- /dev/null
+++ b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/OrderItemKeyDto.java
@@ -0,0 +1,17 @@
+package org.mapstruct.example.dto;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class OrderItemKeyDto {
+
+ private long stockNumber;
+
+ public long getStockNumber() {
+ return stockNumber;
+ }
+
+ public void setStockNumber(long stockNumber) {
+ this.stockNumber = stockNumber;
+ }
+}
diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java b/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java
new file mode 100644
index 00000000..4c3807d7
--- /dev/null
+++ b/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.mapstruct.example.mapper;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.control.DeepClone;
+import org.mapstruct.example.dto.CustomerDto;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @author Sjaak Derksen
+ *
+ * By defining all methods, we force MapStruct to generate new objects for each mapper in stead of
+ * taking shortcuts by mapping an object directly.
+ */
+@Mapper(mappingControl = DeepClone.class)
+public interface Cloner {
+
+ Cloner MAPPER = Mappers.getMapper( Cloner.class );
+
+ CustomerDto clone(CustomerDto customerDto);
+}
diff --git a/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java b/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java
new file mode 100644
index 00000000..3db410cd
--- /dev/null
+++ b/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.mapstruct.example;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.tuple;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.mapstruct.example.dto.CustomerDto;
+import org.mapstruct.example.dto.OrderItemDto;
+import org.mapstruct.example.dto.OrderItemKeyDto;
+import org.mapstruct.example.mapper.Cloner;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class ClonerTest {
+
+ @Test
+ public void testMapDtoToEntity() {
+
+ CustomerDto customerDto = new CustomerDto();
+ customerDto.setId( 10L );
+ customerDto.setCustomerName("Jaques" );
+ OrderItemDto order1 = new OrderItemDto();
+ order1.setName ("Table" );
+ order1.setQuantity( 2L );
+ customerDto.setOrders( new ArrayList<>( Collections.singleton( order1 ) ) );
+ OrderItemKeyDto key = new OrderItemKeyDto();
+ key.setStockNumber( 5 );
+ Map stock = new HashMap( );
+ stock.put( key, order1 );
+ customerDto.setStock( stock );
+
+ CustomerDto customer = Cloner.MAPPER.clone( customerDto );
+
+ // check if cloned
+ assertThat( customer.getId() ).isEqualTo( 10 );
+ assertThat( customer.getCustomerName() ).isEqualTo( "Jaques" );
+ assertThat( customer.getOrders() )
+ .extracting( "name", "quantity" )
+ .containsExactly( tuple( "Table", 2L ) );
+ assertThat( customer.getStock() ).isNotNull();
+ assertThat( customer.getStock() ).hasSize( 1 );
+
+ Map.Entry entry = customer.getStock().entrySet().iterator().next();
+ assertThat( entry.getKey().getStockNumber() ).isEqualTo( 5 );
+ assertThat( entry.getValue().getName() ).isEqualTo( "Table" );
+ assertThat( entry.getValue().getQuantity() ).isEqualTo( 2L );
+
+ // check mapper really created new objects
+ assertThat( customer ).isNotSameAs( customerDto );
+ assertThat( customer.getOrders().get( 0 ) ).isNotEqualTo( order1 );
+ assertThat( entry.getKey() ).isNotEqualTo( key );
+ assertThat( entry.getValue() ).isNotEqualTo( order1 );
+ assertThat( entry.getValue() ).isNotEqualTo( customer.getOrders().get( 0 ) );
+ }
+}
diff --git a/mapstruct-field-mapping/pom.xml b/mapstruct-field-mapping/pom.xml
index b8e0f718..d56f7a00 100644
--- a/mapstruct-field-mapping/pom.xml
+++ b/mapstruct-field-mapping/pom.xml
@@ -1,22 +1,9 @@
1.0.0
- 1.3.0.Beta1
+ UTF-8
+ 1.7.0.Beta1org.mapstruct
- mapstruct-jdk8
+ mapstruct${org.mapstruct.version}
@@ -50,14 +38,14 @@
junitjunit
- 4.12
+ 4.13.1testorg.assertjassertj-core
- 3.6.2
+ 3.27.7test
@@ -68,10 +56,10 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.1
- 1.7
- 1.7
+ 1.8
+ 1.8org.mapstruct
diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java
index 92955700..3365a291 100644
--- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java
+++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.example.dto;
diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java
index 7537a61d..630623dd 100644
--- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java
+++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.example.dto;
diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java
index a939057a..869f28ec 100644
--- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java
+++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java
@@ -1,27 +1,13 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.example.mapper;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
-import org.mapstruct.Mappings;
import org.mapstruct.example.dto.Customer;
import org.mapstruct.example.dto.CustomerDto;
import org.mapstruct.factory.Mappers;
@@ -34,10 +20,8 @@ public interface CustomerMapper {
CustomerMapper MAPPER = Mappers.getMapper( CustomerMapper.class );
- @Mappings({
- @Mapping(source = "orders", target = "orderItems"),
- @Mapping(source = "customerName", target = "name")
- })
+ @Mapping(target = "orderItems", source = "orders")
+ @Mapping(target = "name", source = "customerName")
Customer toCustomer(CustomerDto customerDto);
@InheritInverseConfiguration
diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java
index 43868eb1..16914a28 100644
--- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java
+++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.example.mapper;
diff --git a/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java b/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java
index 5aaf5f19..2c2aa2da 100644
--- a/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java
+++ b/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.example;
diff --git a/mapstruct-iterable-to-non-iterable/pom.xml b/mapstruct-iterable-to-non-iterable/pom.xml
index 4307b1b7..bf2c3293 100644
--- a/mapstruct-iterable-to-non-iterable/pom.xml
+++ b/mapstruct-iterable-to-non-iterable/pom.xml
@@ -1,22 +1,9 @@
@@ -26,8 +13,9 @@
1.0-SNAPSHOT
- 1.7
- 1.7
+ UTF-8
+ 1.8
+ 1.8
@@ -35,20 +23,20 @@
org.mapstructmapstruct
- 1.3.0.Beta1
+ 1.7.0.Beta1org.mapstructmapstruct-processor
- 1.3.0.Beta1
+ 1.7.0.Beta1providedjunitjunit
- 4.12
+ 4.13.1test
@@ -60,7 +48,7 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.1org.mapstruct.ap.MappingProcessor
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java
index 68659e45..4d26e920 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java
index 47a2275c..d70abada 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
index a6547328..34401eba 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
@@ -1,40 +1,24 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
import com.mycompany.mapper.util.FirstElement;
-import com.mycompany.mapper.util.IterableNonInterableUtil;
+import com.mycompany.mapper.util.IterableNonIterableUtil;
import com.mycompany.mapper.util.LastElement;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
-import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
-@Mapper( uses = IterableNonInterableUtil.class )
+@Mapper( uses = IterableNonIterableUtil.class )
public interface SourceTargetMapper {
SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class );
- @Mappings( {
- @Mapping( source = "myIntegers", target = "myInteger", qualifiedBy = FirstElement.class ),
- @Mapping( source = "myStrings", target = "myString", qualifiedBy = LastElement.class )
- } )
+ @Mapping( target = "myInteger", source = "myIntegers", qualifiedBy = FirstElement.class )
+ @Mapping( target = "myString", source = "myStrings", qualifiedBy = LastElement.class )
Target toTarget( Source s );
}
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java
index 78604a19..1cfc37d4 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java
index bd4461d6..8b2c59b9 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper.util;
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java
deleted file mode 100644
index 82d8ab74..00000000
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.mycompany.mapper.util;
-
-import java.util.List;
-//import org.mapstruct.ap.test.selection.qualifier.annotation.TitleTranslator;
-
-/**
- *
- * @author Sjaak Derksen
- */
-public class IterableNonInterableUtil {
-
- @FirstElement
- public T first( List in ) {
- if ( in != null && !in.isEmpty() ) {
- return in.get( 0 );
- }
- else {
- return null;
- }
- }
-
- @LastElement
- public T last( List in ) {
- if ( in != null && !in.isEmpty() ) {
- return in.get( in.size() - 1 );
- }
- else {
- return null;
- }
- }
-
-
-}
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java
new file mode 100644
index 00000000..1db01f88
--- /dev/null
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package com.mycompany.mapper.util;
+
+import java.util.List;
+//import org.mapstruct.ap.test.selection.qualifier.annotation.TitleTranslator;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class IterableNonIterableUtil {
+
+ @FirstElement
+ public T first( List in ) {
+ if ( in != null && !in.isEmpty() ) {
+ return in.get( 0 );
+ }
+ else {
+ return null;
+ }
+ }
+
+ @LastElement
+ public T last( List in ) {
+ if ( in != null && !in.isEmpty() ) {
+ return in.get( in.size() - 1 );
+ }
+ else {
+ return null;
+ }
+ }
+
+
+}
diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java
index 835cccd7..ed402416 100644
--- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java
+++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper.util;
diff --git a/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java b/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
index dc2d77e3..07b5f1d4 100644
--- a/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
+++ b/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-jpa-child-parent/pom.xml b/mapstruct-jpa-child-parent/pom.xml
index 926c59eb..7c3ddf2e 100644
--- a/mapstruct-jpa-child-parent/pom.xml
+++ b/mapstruct-jpa-child-parent/pom.xml
@@ -1,22 +1,9 @@
@@ -26,9 +13,10 @@
1.0-SNAPSHOT
- 1.3.0.Beta1
- 1.7
- 1.7
+ UTF-8
+ 1.7.0.Beta1
+ 1.8
+ 1.8
@@ -54,14 +42,14 @@
junitjunit
- 4.12
+ 4.13.1testorg.assertjassertj-core
- 3.9.0
+ 3.27.7test
@@ -72,10 +60,8 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.1
- 1.7
- 1.7org.mapstruct
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java
index 7b26873a..0fbea00d 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java
index bd9780da..f41fb0a3 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java
index 514269ee..3aecfd7b 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java
index d427efb5..339ef89e 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java
index f349ae38..f6c5a38b 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
index 02bc4dd5..2bb54a32 100644
--- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
+++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java b/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
index 4c57233d..4d6949b5 100644
--- a/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
+++ b/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-kotlin-gradle/build.gradle.kts b/mapstruct-kotlin-gradle/build.gradle.kts
new file mode 100644
index 00000000..9aee9753
--- /dev/null
+++ b/mapstruct-kotlin-gradle/build.gradle.kts
@@ -0,0 +1,43 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ kotlin("jvm") version "1.9.10"
+ kotlin("kapt") version "1.9.10"
+}
+
+group = "org.mapstruct.examples"
+version = "1.0.0-SNAPSHOT"
+
+java.sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_8
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-jdk8"))
+ implementation("org.mapstruct:mapstruct:1.7.0.Beta1")
+ kapt("org.mapstruct:mapstruct-processor:1.7.0.Beta1")
+
+ testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
+ testImplementation("org.junit.jupiter:junit-jupiter-engine:5.3.1")
+ testImplementation("org.assertj:assertj-core:3.11.1")
+}
+
+
+kapt {
+ arguments {
+ // Set Mapstruct Configuration options here
+ // https://kotlinlang.org/docs/reference/kapt.html#annotation-processor-arguments
+ // https://mapstruct.org/documentation/stable/reference/html/#configuration-options
+ // arg("mapstruct.defaultComponentModel", "spring")
+ }
+}
+
+tasks.withType {
+ kotlinOptions.jvmTarget = "1.8"
+}
+
+val test by tasks.getting(Test::class) {
+ useJUnitPlatform { }
+}
diff --git a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..e708b1c0
Binary files /dev/null and b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..db9a6b82
--- /dev/null
+++ b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/mapstruct-kotlin-gradle/gradlew b/mapstruct-kotlin-gradle/gradlew
new file mode 100755
index 00000000..4f906e0c
--- /dev/null
+++ b/mapstruct-kotlin-gradle/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/mapstruct-kotlin-gradle/gradlew.bat b/mapstruct-kotlin-gradle/gradlew.bat
new file mode 100644
index 00000000..107acd32
--- /dev/null
+++ b/mapstruct-kotlin-gradle/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/mapstruct-kotlin-gradle/settings.gradle b/mapstruct-kotlin-gradle/settings.gradle
new file mode 100644
index 00000000..26a174d5
--- /dev/null
+++ b/mapstruct-kotlin-gradle/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'mapstruct-kotlin-gradle'
+
diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/Main.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/Main.kt
new file mode 100644
index 00000000..d381262b
--- /dev/null
+++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/Main.kt
@@ -0,0 +1,20 @@
+package org.mapstruct.example.kotlin
+
+import org.mapstruct.example.kotlin.converter.PersonConverter
+import org.mapstruct.example.kotlin.model.Person
+import org.mapstruct.factory.Mappers
+import java.time.LocalDate
+
+fun main(args: Array) {
+
+ val converter = Mappers.getMapper(PersonConverter::class.java) // or PersonConverterImpl()
+
+ val person = Person("Samuel", "Jackson", "0123 334466", LocalDate.of(1948, 12, 21))
+
+ val personDto = converter.convertToDto(person)
+ println(personDto)
+
+ val personModel = converter.convertToModel(personDto)
+ println(personModel)
+
+}
diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt
new file mode 100644
index 00000000..4f009cec
--- /dev/null
+++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt
@@ -0,0 +1,18 @@
+package org.mapstruct.example.kotlin.converter
+
+import org.mapstruct.InheritInverseConfiguration
+import org.mapstruct.Mapper
+import org.mapstruct.Mapping
+import org.mapstruct.example.kotlin.dto.PersonDto
+import org.mapstruct.example.kotlin.model.Person
+
+@Mapper
+interface PersonConverter {
+
+ @Mapping(target = "phone", source = "phoneNumber")
+ fun convertToDto(person: Person): PersonDto
+
+ @InheritInverseConfiguration
+ fun convertToModel(personDto: PersonDto): Person
+
+}
diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt
new file mode 100644
index 00000000..c6080361
--- /dev/null
+++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt
@@ -0,0 +1,5 @@
+package org.mapstruct.example.kotlin.dto
+
+import java.time.LocalDate
+
+data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?)
diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt
new file mode 100644
index 00000000..ca3ad1ef
--- /dev/null
+++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt
@@ -0,0 +1,5 @@
+package org.mapstruct.example.kotlin.model
+
+import java.time.LocalDate
+
+data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?)
diff --git a/mapstruct-kotlin-gradle/src/test/kotlin/org/mapstruct/example/kotlin/converter/PersonConverterTest.kt b/mapstruct-kotlin-gradle/src/test/kotlin/org/mapstruct/example/kotlin/converter/PersonConverterTest.kt
new file mode 100644
index 00000000..8a5875d9
--- /dev/null
+++ b/mapstruct-kotlin-gradle/src/test/kotlin/org/mapstruct/example/kotlin/converter/PersonConverterTest.kt
@@ -0,0 +1,40 @@
+package org.mapstruct.example.kotlin.converter
+
+import org.mapstruct.example.kotlin.dto.PersonDto
+import org.mapstruct.example.kotlin.model.Person
+
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.Test
+import org.mapstruct.factory.Mappers
+import java.time.LocalDate
+
+class PersonConverterTest {
+
+ @Test
+ fun testConvertToDto() {
+ val converter = Mappers.getMapper(PersonConverter::class.java)
+
+ val person = Person("Samuel", "Jackson", "0123 334466", LocalDate.of(1948, 12, 21))
+
+ val personDto = converter.convertToDto(person)
+ assertThat(personDto).isNotNull
+ assertThat(personDto.firstName).isEqualTo("Samuel")
+ assertThat(personDto.lastName).isEqualTo("Jackson")
+ assertThat(personDto.phone).isEqualTo("0123 334466")
+ assertThat(personDto.birthdate).isEqualTo(LocalDate.of(1948, 12, 21))
+ }
+
+ @Test
+ fun testConvertToModel() {
+ val converter = Mappers.getMapper(PersonConverter::class.java)
+
+ val personDto = PersonDto("Samuel", "Jackson", "0123 334466", LocalDate.of(1948, 12, 21))
+
+ val person = converter.convertToModel(personDto)
+ assertThat(person).isNotNull
+ assertThat(person.firstName).isEqualTo("Samuel")
+ assertThat(person.lastName).isEqualTo("Jackson")
+ assertThat(person.phoneNumber).isEqualTo("0123 334466")
+ assertThat(person.birthdate).isEqualTo(LocalDate.of(1948, 12, 21))
+ }
+}
diff --git a/mapstruct-kotlin/README.md b/mapstruct-kotlin/README.md
index 20f2d2d8..15c954ee 100644
--- a/mapstruct-kotlin/README.md
+++ b/mapstruct-kotlin/README.md
@@ -7,17 +7,11 @@ Example usage of MapStruct and Kotlin with JDK-8 Bytecode. This is achieved by u
In this example we want to map between a Person (Model) and a PersonDto (DTO).
```kotlin
-data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) {
- // Necessary for MapStruct
- constructor() : this(null, null, null, null)
-}
+data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?)
```
```kotlin
-data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) {
- // Necessary for MapStruct
- constructor() : this(null, null, null, null)
-}
+data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?)
```
The MapStruct converter:
@@ -26,7 +20,7 @@ The MapStruct converter:
@Mapper
interface PersonConverter {
- @Mapping(source = "phoneNumber", target = "phone")
+ @Mapping(target = "phone", source = "phoneNumber")
fun convertToDto(person: Person) : PersonDto
@InheritInverseConfiguration
@@ -74,12 +68,12 @@ Kotlin: https://kotlinlang.org/
## Maven Setup
-Add `mapstruct-jdk8` to your dependencies
+Add `mapstruct` to your dependencies
```xml
org.mapstruct
- mapstruct-jdk8
+ mapstruct${mapstruct.version}
```
diff --git a/mapstruct-kotlin/pom.xml b/mapstruct-kotlin/pom.xml
index f046641b..6919a6a3 100644
--- a/mapstruct-kotlin/pom.xml
+++ b/mapstruct-kotlin/pom.xml
@@ -9,20 +9,18 @@
1.0.0-SNAPSHOTjar
- Sample application demonstration the use of MapStruct and Kotlin
-
UTF-8
- 1.2.51
+ 2.3.01.8
- 1.3.0.Beta1
+ 1.7.0.Beta1org.mapstruct
- mapstruct-jdk8
+ mapstruct${mapstruct.version}
@@ -40,13 +38,13 @@
junitjunit
- 4.12
+ 4.13.1testorg.assertjassertj-core
- 3.8.0
+ 3.27.7test
@@ -77,6 +75,11 @@
mapstruct-processor${mapstruct.version}
+
+ org.jetbrains.kotlin
+ kotlin-metadata-jvm
+ ${kotlin.version}
+
@@ -100,7 +103,7 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.1none${kotlin.compiler.jvmTarget}
diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt
index 9f9186cc..4f009cec 100644
--- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt
+++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt
@@ -9,7 +9,7 @@ import org.mapstruct.example.kotlin.model.Person
@Mapper
interface PersonConverter {
- @Mapping(source = "phoneNumber", target = "phone")
+ @Mapping(target = "phone", source = "phoneNumber")
fun convertToDto(person: Person): PersonDto
@InheritInverseConfiguration
diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt
index c42402da..c6080361 100644
--- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt
+++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt
@@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.dto
import java.time.LocalDate
-data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) {
-
- // Necessary for MapStruct
- constructor() : this(null, null, null, null)
-
-}
+data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?)
diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt
index af6086b3..ca3ad1ef 100644
--- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt
+++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt
@@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.model
import java.time.LocalDate
-data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) {
-
- // Necessary for MapStruct
- constructor() : this(null, null, null, null)
-
-}
+data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?)
diff --git a/mapstruct-lombok/build.gradle b/mapstruct-lombok/build.gradle
index 3d7f5700..67efc56c 100644
--- a/mapstruct-lombok/build.gradle
+++ b/mapstruct-lombok/build.gradle
@@ -1,6 +1,5 @@
plugins {
id 'java'
- id 'net.ltgt.apt' version '0.9'
}
repositories {
@@ -8,19 +7,22 @@ repositories {
mavenLocal()
}
-task wrapper(type: Wrapper) {
- gradleVersion = '3.4'
-}
-
ext {
- mapstructVersion = "1.3.0.Beta1"
- lombokVersion = "1.18.0"
+ mapstructVersion = "1.7.0.Beta1"
+ lombokVersion = "1.18.30"
+ lombokMapstructBindingVersion = "0.2.0"
}
sourceCompatibility = JavaVersion.VERSION_1_8
dependencies {
- compile "org.mapstruct:mapstruct-jdk8:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
- testCompile 'junit:junit:4.12'
- apt "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
+ implementation "org.mapstruct:mapstruct:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
+ testImplementation 'junit:junit:4.13.1'
+
+ /*
+ this example uses lombok directly over the annotationProcessor,
+ the io.freefair.lombok plugin works as well.
+ The freefair-lombok plugin is used in the example mapstruct-on-gradle-testcp-with-lombok
+ */
+ annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}", "org.projectlombok:lombok-mapstruct-binding:${lombokMapstructBindingVersion}"
}
diff --git a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar
index 05ef575b..e708b1c0 100644
Binary files a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar and b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties
index 6b3ef346..db9a6b82 100644
--- a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties
+++ b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Sat Feb 25 23:47:27 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
diff --git a/mapstruct-lombok/gradlew b/mapstruct-lombok/gradlew
index 9d82f789..4f906e0c 100755
--- a/mapstruct-lombok/gradlew
+++ b/mapstruct-lombok/gradlew
@@ -1,4 +1,20 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
##############################################################################
##
@@ -6,20 +22,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,28 +75,14 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -85,7 +106,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -105,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -134,27 +156,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/mapstruct-lombok/gradlew.bat b/mapstruct-lombok/gradlew.bat
index 8a0b282a..107acd32 100644
--- a/mapstruct-lombok/gradlew.bat
+++ b/mapstruct-lombok/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,20 +24,23 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,34 +64,14 @@ echo location of your Java installation.
goto fail
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/mapstruct-lombok/pom.xml b/mapstruct-lombok/pom.xml
index ccce4906..f29a0a4a 100644
--- a/mapstruct-lombok/pom.xml
+++ b/mapstruct-lombok/pom.xml
@@ -1,22 +1,9 @@
@@ -29,37 +16,42 @@
jarUTF-8
- 1.7
- 1.7
- 1.3.0.Beta1
- 1.18.0
+ 1.8
+ 1.8
+ 1.7.0.Beta1
+ 1.18.30
+ 0.2.0
-
- org.projectlombok
- lombok
- ${org.projectlombok.version}
- provided
- org.mapstructmapstruct${org.mapstruct.version}
+
+
+ org.projectlombok
+ lombok
+ ${org.projectlombok.version}
+ provided
+
+
+
+
junitjunittest
- 4.12
+ 4.13.1
@@ -69,7 +61,35 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.1
+
+ 1.8
+ 1.8
+
+
+
+
+
+
+
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${org.mapstruct.version}
+
+
+ org.projectlombok
+ lombok
+ ${org.projectlombok.version}
+
+
+ org.projectlombok
+ lombok-mapstruct-binding
+ ${lombok-mapstruct-binding.version}
+
+
+
diff --git a/mapstruct-lombok/settings.gradle b/mapstruct-lombok/settings.gradle
new file mode 100644
index 00000000..ea5c17eb
--- /dev/null
+++ b/mapstruct-lombok/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'mapstruct-lombok'
diff --git a/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java b/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java
index c4aada7a..dc4f0cd9 100644
--- a/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java
+++ b/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.dto;
diff --git a/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java b/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java
index afc3d0c5..223a8860 100644
--- a/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java
+++ b/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.entities;
diff --git a/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java b/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java
index 1956327c..a8fd6b3d 100644
--- a/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java
+++ b/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java b/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
index 33cc99c1..bf3ae459 100644
--- a/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
+++ b/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
@@ -30,6 +17,6 @@ public interface SourceTargetMapper {
SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class );
- @Mapping( source = "test", target = "testing" )
+ @Mapping( target = "testing", source = "test" )
Target toTarget( Source s );
}
diff --git a/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java b/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
index 49f57c15..4110d79e 100644
--- a/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
+++ b/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package com.mycompany.mapper;
diff --git a/mapstruct-lookup-entity-with-id/pom.xml b/mapstruct-lookup-entity-with-id/pom.xml
index 52db1309..b7b7e946 100644
--- a/mapstruct-lookup-entity-with-id/pom.xml
+++ b/mapstruct-lookup-entity-with-id/pom.xml
@@ -1,22 +1,9 @@
@@ -26,7 +13,8 @@
1.0-SNAPSHOT
- 1.3.0.Beta1
+ UTF-8
+ 1.7.0.Beta1
@@ -38,7 +26,7 @@
org.mapstruct
- mapstruct-jdk8
+ mapstruct${org.mapstruct.version}
@@ -52,14 +40,14 @@
junitjunit
- 4.12
+ 4.13.1testorg.assertjassertj-core
- 3.9.0
+ 3.27.7test
@@ -70,7 +58,7 @@
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.2
+ 3.14.11.81.8
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java
index 1fea0b5d..139e7e93 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java
index 03cfc991..77660458 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java
index 3e1bab20..65ae07a5 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java
index a52c784d..e9e34bb4 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
index cd187f5c..e2cd10ff 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
+/*
+ * Copyright MapStruct Authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java
index 692a4b34..43ded1d9 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java
index 01a71ffc..59f667e1 100644
--- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java
+++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java b/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
index 8e760cca..dfde755d 100644
--- a/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
+++ b/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java
@@ -1,20 +1,7 @@
-/**
- * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
- * and/or other contributors as indicated by the @authors tag. See the
- * copyright.txt file in the distribution for a full listing of all
- * contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * Copyright MapStruct Authors.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.jpa;
diff --git a/mapstruct-mapper-repo/example/pom.xml b/mapstruct-mapper-repo/example/pom.xml
new file mode 100755
index 00000000..96735a69
--- /dev/null
+++ b/mapstruct-mapper-repo/example/pom.xml
@@ -0,0 +1,66 @@
+
+ 4.0.0
+ repo-example
+
+
+ org.mapstruct.examples.repo
+ repo
+ 0.0.1-SNAPSHOT
+ ..
+
+
+
+ UTF-8
+
+
+
+
+
+ org.mapstruct.examples.repo
+ repo-generator
+
+
+
+ org.mapstruct
+ mapstruct
+
+
+
+ org.mapstruct
+ mapstruct-processor
+
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${org.mapstruct.version}
+
+
+ org.mapstruct.examples.repo
+ repo-generator
+ ${project.version}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Boss.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Boss.java
new file mode 100755
index 00000000..1ff06bc0
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Boss.java
@@ -0,0 +1,91 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public class Boss {
+
+ private String name;
+ private String title;
+ private String address;
+ private Long age;
+
+ public Boss() {
+
+ }
+
+ /**
+ * Construct!
+ *
+ * @param name
+ * @param address
+ * @param age
+ */
+ public Boss(String name, String title, String address, Long age) {
+ super();
+ this.name = name;
+ this.title = title;
+ this.address = address;
+ this.age = age;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the address
+ */
+ public String getAddress() {
+ return address;
+ }
+ /**
+ * @param address
+ * the address to set
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+ /**
+ * @return the age
+ */
+ public Long getAge() {
+ return age;
+ }
+ /**
+ * @param age
+ * the age to set
+ */
+ public void setAge(Long age) {
+ this.age = age;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title
+ * the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Car.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Car.java
new file mode 100755
index 00000000..9a4c6e23
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Car.java
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public class Car {
+
+ private String make;
+ private int numberOfSeats;
+ private CarType type;
+
+ /**
+ * Construct!
+ *
+ */
+ public Car() {
+
+ }
+
+ /**
+ * Construct!
+ *
+ * @param make
+ * @param numberOfSeats
+ * @param type
+ */
+ public Car(String make, int numberOfSeats, CarType type) {
+ super();
+ this.make = make;
+ this.numberOfSeats = numberOfSeats;
+ this.type = type;
+ }
+
+ /**
+ * @return the make
+ */
+ public String getMake() {
+ return make;
+ }
+ /**
+ * @param make
+ * the make to set
+ */
+ public void setMake(String make) {
+ this.make = make;
+ }
+ /**
+ * @return the numberOfSeats
+ */
+ public int getNumberOfSeats() {
+ return numberOfSeats;
+ }
+ /**
+ * @param numberOfSeats
+ * the numberOfSeats to set
+ */
+ public void setNumberOfSeats(int numberOfSeats) {
+ this.numberOfSeats = numberOfSeats;
+ }
+ /**
+ * @return the type
+ */
+ public CarType getType() {
+ return type;
+ }
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(CarType type) {
+ this.type = type;
+ }
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarDto.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarDto.java
new file mode 100755
index 00000000..a8d2a12b
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarDto.java
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public class CarDto {
+
+ private String make;
+ private int seatCount;
+ private String type;
+
+ /**
+ * Construct!
+ *
+ */
+ public CarDto() {
+
+ }
+
+ /**
+ * Construct!
+ *
+ * @param make
+ * @param seatCount
+ * @param type
+ */
+ public CarDto(String make, int seatCount, String type) {
+ super();
+ this.make = make;
+ this.seatCount = seatCount;
+ this.type = type;
+ }
+
+ /**
+ * @return the make
+ */
+ public String getMake() {
+ return make;
+ }
+ /**
+ * @param make
+ * the make to set
+ */
+ public void setMake(String make) {
+ this.make = make;
+ }
+ /**
+ * @return the seatCount
+ */
+ public int getSeatCount() {
+ return seatCount;
+ }
+ /**
+ * @param seatCount
+ * the seatCount to set
+ */
+ public void setSeatCount(int seatCount) {
+ this.seatCount = seatCount;
+ }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarType.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarType.java
new file mode 100755
index 00000000..8a8784da
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/CarType.java
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public enum CarType {
+
+ SPORTS, OTHER;
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Employee.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Employee.java
new file mode 100755
index 00000000..0c9ba5a2
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Employee.java
@@ -0,0 +1,74 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public class Employee {
+
+ private String name;
+ private String address;
+ private Long age;
+
+ public Employee() {
+
+ }
+
+ /**
+ * Construct!
+ *
+ * @param name
+ * @param address
+ * @param age
+ */
+ public Employee(String name, String address, Long age) {
+ super();
+ this.name = name;
+ this.address = address;
+ this.age = age;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the address
+ */
+ public String getAddress() {
+ return address;
+ }
+ /**
+ * @param address
+ * the address to set
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+ /**
+ * @return the age
+ */
+ public Long getAge() {
+ return age;
+ }
+ /**
+ * @param age
+ * the age to set
+ */
+ public void setAge(Long age) {
+ this.age = age;
+ }
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Person.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Person.java
new file mode 100755
index 00000000..2878a044
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/domain/Person.java
@@ -0,0 +1,96 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.domain;
+
+/**
+ * @author jucheme
+ *
+ */
+public class Person {
+
+ private String firstName;
+ private String lastName;
+ private String address;
+ private Long age;
+
+ public Person() {
+ }
+
+ /**
+ * Construct!
+ *
+ * @param firstName
+ * @param lastName
+ * @param address
+ * @param age
+ */
+ public Person(String firstName, String lastName, String address, Long age) {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.address = address;
+ this.age = age;
+ }
+
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName
+ * the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName
+ * the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return the address
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @param address
+ * the address to set
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ /**
+ * @return the age
+ */
+ public Long getAge() {
+ return age;
+ }
+
+ /**
+ * @param age
+ * the age to set
+ */
+ public void setAge(Long age) {
+ this.age = age;
+ }
+
+}
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java
new file mode 100755
index 00000000..b2d24a70
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.mappers;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.NullValuePropertyMappingStrategy;
+import org.mapstruct.example.repo.AddToRepo;
+import org.mapstruct.example.repo.StandardMapper;
+import org.mapstruct.example.repo.domain.Car;
+import org.mapstruct.example.repo.domain.CarDto;
+
+/**
+ * @author jucheme
+ *
+ */
+@AddToRepo
+@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
+public interface CarMapper extends StandardMapper {
+
+ @Mapping(target = "seatCount", source = "numberOfSeats")
+ CarDto map(Car Car);
+}
\ No newline at end of file
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java
new file mode 100755
index 00000000..68e1707f
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.mappers;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.example.repo.AddToRepo;
+import org.mapstruct.example.repo.StandardMapper;
+import org.mapstruct.example.repo.domain.Employee;
+import org.mapstruct.example.repo.domain.Person;
+
+/**
+ * @author jucheme
+ *
+ */
+@AddToRepo
+@Mapper
+public interface PersonMapper extends StandardMapper {
+
+ @Mapping(target = "name", source = "firstName")
+ Employee map(Person p);
+}
\ No newline at end of file
diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java
new file mode 100755
index 00000000..8f7616fb
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo.mappers;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.example.repo.AddToRepo;
+import org.mapstruct.example.repo.StandardMapper;
+import org.mapstruct.example.repo.domain.Boss;
+import org.mapstruct.example.repo.domain.Person;
+
+/**
+ * @author jucheme
+ *
+ */
+@AddToRepo
+@Mapper
+public interface PersonToBossMapper extends StandardMapper {
+
+ @Mapping(target = "name", source = "firstName")
+ @Mapping(target = "title", constant = "Boss")
+ Boss map(Person p);
+}
\ No newline at end of file
diff --git a/mapstruct-mapper-repo/example/src/test/java/org/mapstruct/example/repo/TestMapperRepo.java b/mapstruct-mapper-repo/example/src/test/java/org/mapstruct/example/repo/TestMapperRepo.java
new file mode 100755
index 00000000..3286f711
--- /dev/null
+++ b/mapstruct-mapper-repo/example/src/test/java/org/mapstruct/example/repo/TestMapperRepo.java
@@ -0,0 +1,79 @@
+/**
+ *
+ */
+package org.mapstruct.example.repo;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.mapstruct.example.repo.domain.Boss;
+import org.mapstruct.example.repo.domain.Car;
+import org.mapstruct.example.repo.domain.CarDto;
+import org.mapstruct.example.repo.domain.CarType;
+import org.mapstruct.example.repo.domain.Employee;
+import org.mapstruct.example.repo.domain.Person;
+
+/**
+ * @author jucheme
+ *
+ */
+public class TestMapperRepo {
+
+ @Test
+ public void testMapToFromNew() {
+ MapperRepo mf = MapperRepo.getInstance();
+ Car car = new Car("Morris", 5, CarType.SPORTS);
+ Person p = new Person("mark", "juchems", "411 manor", 54L);
+
+ CarDto c = mf.map(car, CarDto.class);
+ System.out.println(c);
+
+ Employee e = mf.map(p, Employee.class);
+ System.out.println(e);
+
+ Boss b = mf.map(p, Boss.class);
+ System.out.println(b);
+ }
+
+ @Test
+ public void testMapObjectToObject() {
+ MapperRepo mf = MapperRepo.getInstance();
+ Car car = new Car("Morris", 5, CarType.SPORTS);
+
+ CarDto carDto = new CarDto();
+ carDto.setMake("toyota");
+ CarDto x = mf.map(car, carDto);
+ Assert.assertSame(x, carDto);
+ Assert.assertEquals("Morris", carDto.getMake());
+ }
+
+ /**
+ * Test mapAll
+ */
+ @Test
+ public void testMapAll() {
+ MapperRepo mf = MapperRepo.getInstance();
+ Person p = new Person("mark", "juchems", "411 manor", 54L);
+
+ List