Package org.mapstruct
Annotation Type Mappings
Configures the mappings of several bean attributes.
TIP: When using Java 8 or later, you can omit the @Mappings wrapper annotation and directly specify several @Mapping annotations on one method.
These two examples are equal.
// before Java 8
@Mapper
public interface MyMapper {
@Mappings({
@Mapping(target = "firstProperty", source = "first"),
@Mapping(target = "secondProperty", source = "second")
})
HumanDto toHumanDto(Human human);
}
// Java 8 and later
@Mapper
public interface MyMapper {
@Mapping(target = "firstProperty", source = "first"),
@Mapping(target = "secondProperty", source = "second")
HumanDto toHumanDto(Human human);
}
- Author:
- Gunnar Morling
-
Required Element Summary
Required Elements
-
Element Details
-
value
Mapping[] valueThe configuration of the bean attributes.- Returns:
- The configuration of the bean attributes.
-