All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mapstruct.ValueMappings Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
/*
 * 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;

/**
 * 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 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) public @interface ValueMappings { ValueMapping[] value(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy