forked from mapstruct/mapstruct
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMappings.java
More file actions
54 lines (51 loc) · 1.51 KB
/
Mappings.java
File metadata and controls
54 lines (51 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Configures the mappings of several bean attributes.
* <p>
* <strong>TIP: When using Java 8 or later, you can omit the @Mappings
* wrapper annotation and directly specify several @Mapping annotations on one method.</strong>
*
* <p>These two examples are equal.
* </p>
* <pre><code class='java'>
* // before Java 8
* @Mapper
* public interface MyMapper {
* @Mappings({
* @Mapping(target = "firstProperty", source = "first"),
* @Mapping(target = "secondProperty", source = "second")
* })
* HumanDto toHumanDto(Human human);
* }
* </code></pre>
* <pre><code class='java'>
* // Java 8 and later
* @Mapper
* public interface MyMapper {
* @Mapping(target = "firstProperty", source = "first"),
* @Mapping(target = "secondProperty", source = "second")
* HumanDto toHumanDto(Human human);
* }
* </code></pre>
*
* @author Gunnar Morling
*/
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE })
public @interface Mappings {
/**
* The configuration of the bean attributes.
*
* @return The configuration of the bean attributes.
*/
Mapping[] value();
}