Skip to content

Commit e0503d6

Browse files
authored
57 repository generator. (#62)
1 parent 362a43d commit e0503d6

23 files changed

Lines changed: 1196 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Currently, the following examples exist:
2323
* _mapstruct-lookup-entity-with-composed-key_: Shows how an object with composite key can be read from the database in a mapping method.
2424
* _mapstruct-clone_: Shows how an object can be deeply cloned by defining all mapping methods.
2525
* _mapstruct-metadata-annotations_: Demonstrates how to read annotations and use them as mapping instruction.
26+
* _mapstruct-mappers-repo_: Demonstrates how one can build a repo of mappers by means of code generation.
2627

2728
## License
2829

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<artifactId>repo-example</artifactId>
6+
7+
<parent>
8+
<groupId>org.mapstruct.examples.repo</groupId>
9+
<artifactId>repo</artifactId>
10+
<version>0.0.1-SNAPSHOT</version>
11+
<relativePath>..</relativePath>
12+
</parent>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<dependencies>
19+
20+
<dependency>
21+
<groupId>org.mapstruct.examples.repo</groupId>
22+
<artifactId>repo-generator</artifactId>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>org.mapstruct</groupId>
27+
<artifactId>mapstruct</artifactId>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>org.mapstruct</groupId>
32+
<artifactId>mapstruct-processor</artifactId>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>junit</groupId>
37+
<artifactId>junit</artifactId>
38+
<scope>test</scope>
39+
</dependency>
40+
41+
</dependencies>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-compiler-plugin</artifactId>
48+
<configuration>
49+
<annotationProcessorPaths>
50+
<path>
51+
<groupId>org.mapstruct</groupId>
52+
<artifactId>mapstruct-processor</artifactId>
53+
<version>${org.mapstruct.version}</version>
54+
</path>
55+
<path>
56+
<groupId>org.mapstruct.examples.repo</groupId>
57+
<artifactId>repo-generator</artifactId>
58+
<version>${project.version}</version>
59+
</path>
60+
</annotationProcessorPaths>
61+
</configuration>
62+
</plugin>
63+
</plugins>
64+
</build>
65+
66+
</project>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
*
3+
*/
4+
package org.mapstruct.example.repo.domain;
5+
6+
/**
7+
* @author jucheme
8+
*
9+
*/
10+
public class Boss {
11+
12+
private String name;
13+
private String title;
14+
private String address;
15+
private Long age;
16+
17+
public Boss() {
18+
19+
}
20+
21+
/**
22+
* Construct!
23+
*
24+
* @param name
25+
* @param address
26+
* @param age
27+
*/
28+
public Boss(String name, String title, String address, Long age) {
29+
super();
30+
this.name = name;
31+
this.title = title;
32+
this.address = address;
33+
this.age = age;
34+
}
35+
36+
/**
37+
* @return the name
38+
*/
39+
public String getName() {
40+
return name;
41+
}
42+
/**
43+
* @param name
44+
* the name to set
45+
*/
46+
public void setName(String name) {
47+
this.name = name;
48+
}
49+
/**
50+
* @return the address
51+
*/
52+
public String getAddress() {
53+
return address;
54+
}
55+
/**
56+
* @param address
57+
* the address to set
58+
*/
59+
public void setAddress(String address) {
60+
this.address = address;
61+
}
62+
/**
63+
* @return the age
64+
*/
65+
public Long getAge() {
66+
return age;
67+
}
68+
/**
69+
* @param age
70+
* the age to set
71+
*/
72+
public void setAge(Long age) {
73+
this.age = age;
74+
}
75+
76+
/**
77+
* @return the title
78+
*/
79+
public String getTitle() {
80+
return title;
81+
}
82+
83+
/**
84+
* @param title
85+
* the title to set
86+
*/
87+
public void setTitle(String title) {
88+
this.title = title;
89+
}
90+
91+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
*
3+
*/
4+
package org.mapstruct.example.repo.domain;
5+
6+
/**
7+
* @author jucheme
8+
*
9+
*/
10+
public class Car {
11+
12+
private String make;
13+
private int numberOfSeats;
14+
private CarType type;
15+
16+
/**
17+
* Construct!
18+
*
19+
*/
20+
public Car() {
21+
22+
}
23+
24+
/**
25+
* Construct!
26+
*
27+
* @param make
28+
* @param numberOfSeats
29+
* @param type
30+
*/
31+
public Car(String make, int numberOfSeats, CarType type) {
32+
super();
33+
this.make = make;
34+
this.numberOfSeats = numberOfSeats;
35+
this.type = type;
36+
}
37+
38+
/**
39+
* @return the make
40+
*/
41+
public String getMake() {
42+
return make;
43+
}
44+
/**
45+
* @param make
46+
* the make to set
47+
*/
48+
public void setMake(String make) {
49+
this.make = make;
50+
}
51+
/**
52+
* @return the numberOfSeats
53+
*/
54+
public int getNumberOfSeats() {
55+
return numberOfSeats;
56+
}
57+
/**
58+
* @param numberOfSeats
59+
* the numberOfSeats to set
60+
*/
61+
public void setNumberOfSeats(int numberOfSeats) {
62+
this.numberOfSeats = numberOfSeats;
63+
}
64+
/**
65+
* @return the type
66+
*/
67+
public CarType getType() {
68+
return type;
69+
}
70+
/**
71+
* @param type
72+
* the type to set
73+
*/
74+
public void setType(CarType type) {
75+
this.type = type;
76+
}
77+
78+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
*
3+
*/
4+
package org.mapstruct.example.repo.domain;
5+
6+
/**
7+
* @author jucheme
8+
*
9+
*/
10+
public class CarDto {
11+
12+
private String make;
13+
private int seatCount;
14+
private String type;
15+
16+
/**
17+
* Construct!
18+
*
19+
*/
20+
public CarDto() {
21+
22+
}
23+
24+
/**
25+
* Construct!
26+
*
27+
* @param make
28+
* @param seatCount
29+
* @param type
30+
*/
31+
public CarDto(String make, int seatCount, String type) {
32+
super();
33+
this.make = make;
34+
this.seatCount = seatCount;
35+
this.type = type;
36+
}
37+
38+
/**
39+
* @return the make
40+
*/
41+
public String getMake() {
42+
return make;
43+
}
44+
/**
45+
* @param make
46+
* the make to set
47+
*/
48+
public void setMake(String make) {
49+
this.make = make;
50+
}
51+
/**
52+
* @return the seatCount
53+
*/
54+
public int getSeatCount() {
55+
return seatCount;
56+
}
57+
/**
58+
* @param seatCount
59+
* the seatCount to set
60+
*/
61+
public void setSeatCount(int seatCount) {
62+
this.seatCount = seatCount;
63+
}
64+
/**
65+
* @return the type
66+
*/
67+
public String getType() {
68+
return type;
69+
}
70+
/**
71+
* @param type
72+
* the type to set
73+
*/
74+
public void setType(String type) {
75+
this.type = type;
76+
}
77+
78+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
*
3+
*/
4+
package org.mapstruct.example.repo.domain;
5+
6+
/**
7+
* @author jucheme
8+
*
9+
*/
10+
public enum CarType {
11+
12+
SPORTS, OTHER;
13+
14+
}

0 commit comments

Comments
 (0)