Package org.mapstruct
Annotation Type ValueMappings
-
@Target(METHOD) @Retention(CLASS) public @interface ValueMappings
Constructs a set of value (constant) mappings.TIP: When using Java 8 or later, you can omit the @ValueMappings wrapper annotation and directly specify several @ValueMapping annotations on one method.
These two examples are equal
// before Java 8 @Mapper public interface GenderMapper { @ValueMappings({ @ValueMapping(target = "M", source = "MALE"), @ValueMapping(target = "F", source = "FEMALE") }) GenderDto mapToDto(Gender gender); }
//Java 8 and later @Mapper public interface GenderMapper { @ValueMapping(target = "M", source = "MALE"), @ValueMapping(target = "F", source = "FEMALE") GenderDto mapToDto(Gender gender); }
- Author:
- Sjaak Derksen
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description ValueMapping[]
value
-
-
-
Element Detail
-
value
ValueMapping[] value
-
-