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

org.mapstruct.BeanMapping Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
/**
 *  Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
 *  and/or other contributors as indicated by the @authors tag. See the
 *  copyright.txt file in the distribution for a full listing of all
 *  contributors.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.mapstruct;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Configures the mapping between two bean types.
 * 

* Either {@link #resultType()}, {@link #qualifiedBy()} or {@link #nullValueMappingStrategy()} must be specified. *

* * @author Sjaak Derksen */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) public @interface BeanMapping { /** * Specifies the result type of the factory method to be used in case several factory methods qualify. * * @return the resultType to select */ Class resultType() default void.class; /** * A qualifier can be specified to aid the selection process of a suitable factory method or filtering applicable * {@code @}{@link BeforeMapping} / {@code @}{@link AfterMapping} methods. This is useful in case multiple factory * method (hand written of internal) qualify and result in an 'Ambiguous factory methods' error. *

* A qualifier is a custom annotation and can be placed on either a hand written mapper class or a method. * * @return the qualifiers * @see BeanMapping#qualifiedByName() */ Class[] qualifiedBy() default { }; /** * Similar to {@link #qualifiedBy()}, but used in combination with {@code @}{@link Named} in case no custom * qualifier annotation is defined. * * @return the qualifiers * @see Named */ String[] qualifiedByName() default { }; /** * The strategy to be applied when {@code null} is passed as source value to this bean mapping. If no * strategy is configured, the strategy given via {@link MapperConfig#nullValueMappingStrategy()} or * {@link Mapper#nullValueMappingStrategy()} will be applied, using {@link NullValueMappingStrategy#RETURN_NULL} * by default. * * @return The strategy to be applied when {@code null} is passed as source value to the methods of this mapping. */ NullValueMappingStrategy nullValueMappingStrategy() default NullValueMappingStrategy.RETURN_NULL; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy