Skip to content

Commit 42fda11

Browse files
committed
Update examples to use Java 8, mapstruct module and Mapping Repeatable annotation
1 parent 1604093 commit 42fda11

28 files changed

Lines changed: 65 additions & 99 deletions

File tree

mapstruct-field-mapping/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<dependencies>
3434
<dependency>
3535
<groupId>org.mapstruct</groupId>
36-
<artifactId>mapstruct-jdk8</artifactId>
36+
<artifactId>mapstruct</artifactId>
3737
<version>${org.mapstruct.version}</version>
3838
</dependency>
3939

@@ -70,8 +70,8 @@
7070
<artifactId>maven-compiler-plugin</artifactId>
7171
<version>3.6.2</version>
7272
<configuration>
73-
<source>1.7</source>
74-
<target>1.7</target>
73+
<source>1.8</source>
74+
<target>1.8</target>
7575
<annotationProcessorPaths>
7676
<path>
7777
<groupId>org.mapstruct</groupId>

mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.mapstruct.InheritInverseConfiguration;
2222
import org.mapstruct.Mapper;
2323
import org.mapstruct.Mapping;
24-
import org.mapstruct.Mappings;
2524
import org.mapstruct.example.dto.Customer;
2625
import org.mapstruct.example.dto.CustomerDto;
2726
import org.mapstruct.factory.Mappers;
@@ -34,10 +33,8 @@ public interface CustomerMapper {
3433

3534
CustomerMapper MAPPER = Mappers.getMapper( CustomerMapper.class );
3635

37-
@Mappings({
38-
@Mapping(source = "orders", target = "orderItems"),
39-
@Mapping(source = "customerName", target = "name")
40-
})
36+
@Mapping(source = "orders", target = "orderItems")
37+
@Mapping(source = "customerName", target = "name")
4138
Customer toCustomer(CustomerDto customerDto);
4239

4340
@InheritInverseConfiguration

mapstruct-iterable-to-non-iterable/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<version>1.0-SNAPSHOT</version>
2727

2828
<properties>
29-
<maven.compiler.source>1.7</maven.compiler.source>
30-
<maven.compiler.target>1.7</maven.compiler.target>
29+
<maven.compiler.source>1.8</maven.compiler.source>
30+
<maven.compiler.target>1.8</maven.compiler.target>
3131
</properties>
3232

3333
<dependencies>

mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.mycompany.mapper.util.LastElement;
2424
import org.mapstruct.Mapper;
2525
import org.mapstruct.Mapping;
26-
import org.mapstruct.Mappings;
2726
import org.mapstruct.factory.Mappers;
2827

2928

@@ -32,9 +31,7 @@ public interface SourceTargetMapper {
3231

3332
SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class );
3433

35-
@Mappings( {
36-
@Mapping( source = "myIntegers", target = "myInteger", qualifiedBy = FirstElement.class ),
37-
@Mapping( source = "myStrings", target = "myString", qualifiedBy = LastElement.class )
38-
} )
34+
@Mapping( source = "myIntegers", target = "myInteger", qualifiedBy = FirstElement.class )
35+
@Mapping( source = "myStrings", target = "myString", qualifiedBy = LastElement.class )
3936
Target toTarget( Source s );
4037
}

mapstruct-jpa-child-parent/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
<properties>
2929
<org.mapstruct.version>1.3.0.Beta2</org.mapstruct.version>
30-
<maven.compiler.source>1.7</maven.compiler.source>
31-
<maven.compiler.target>1.7</maven.compiler.target>
30+
<maven.compiler.source>1.8</maven.compiler.source>
31+
<maven.compiler.target>1.8</maven.compiler.target>
3232
</properties>
3333

3434
<dependencies>
@@ -74,8 +74,6 @@
7474
<artifactId>maven-compiler-plugin</artifactId>
7575
<version>3.6.2</version>
7676
<configuration>
77-
<source>1.7</source>
78-
<target>1.7</target>
7977
<annotationProcessorPaths>
8078
<path>
8179
<groupId>org.mapstruct</groupId>

mapstruct-kotlin-gradle/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repositories {
1414

1515
dependencies {
1616
compile(kotlin("stdlib-jdk8"))
17-
compile("org.mapstruct:mapstruct-jdk8:1.3.0.Beta2")
17+
compile("org.mapstruct:mapstruct:1.3.0.Beta2")
1818
kapt("org.mapstruct:mapstruct-processor:1.3.0.Beta2")
1919

2020
testCompile("org.junit.jupiter:junit-jupiter-api:5.3.1")

mapstruct-kotlin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ Kotlin: https://kotlinlang.org/
7474

7575
## Maven Setup
7676

77-
Add `mapstruct-jdk8` to your dependencies
77+
Add `mapstruct` to your dependencies
7878

7979
```xml
8080
<dependency>
8181
<groupId>org.mapstruct</groupId>
82-
<artifactId>mapstruct-jdk8</artifactId>
82+
<artifactId>mapstruct</artifactId>
8383
<version>${mapstruct.version}</version>
8484
</dependency>
8585
```

mapstruct-kotlin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependencies>
2323
<dependency>
2424
<groupId>org.mapstruct</groupId>
25-
<artifactId>mapstruct-jdk8</artifactId>
25+
<artifactId>mapstruct</artifactId>
2626
<version>${mapstruct.version}</version>
2727
</dependency>
2828

mapstruct-lombok/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ext {
2020
sourceCompatibility = JavaVersion.VERSION_1_8
2121

2222
dependencies {
23-
compile "org.mapstruct:mapstruct-jdk8:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
23+
compile "org.mapstruct:mapstruct:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
2424
testCompile 'junit:junit:4.12'
2525
apt "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
2626
}

mapstruct-lombok/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
<packaging>jar</packaging>
3030
<properties>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
32-
<maven.compiler.source>1.7</maven.compiler.source>
33-
<maven.compiler.target>1.7</maven.compiler.target>
32+
<maven.compiler.source>1.8</maven.compiler.source>
33+
<maven.compiler.target>1.8</maven.compiler.target>
3434
<org.mapstruct.version>1.3.0.Beta2</org.mapstruct.version>
3535
<org.projectlombok.version>1.18.0</org.projectlombok.version>
3636
</properties>

0 commit comments

Comments
 (0)