org.mapstruct

Annotation Type Mapper



  • @Target(value=TYPE) @Retention(value=CLASS)public @interface Mapper
    Marks an interface or abstract class as a mapper and activates the generation of a implementation of that type via MapStruct.
    Author:
    Gunnar Morling
    • Element Detail

      • uses

        public abstract Class<?>[] uses
        Other mapper types used by this mapper. May be hand-written classes or other mappers generated by MapStruct. No cycle between generated mapper classes must be created.
        Returns:
        The mapper types used by this mapper.
        Default:
        {}
      • imports

        public abstract Class<?>[] imports
        Additional types for which an import statement is to be added to the generated mapper implementation class. This allows to refer to those types from within mapping expressions given via Mapping.expression() using their simple name rather than their fully-qualified name.
        Returns:
        classes to add in the imports of the generated implementation.
        Default:
        {}
      • unmappedTargetPolicy

        public abstract ReportingPolicy unmappedTargetPolicy
        How unmapped properties of the target type of a mapping should be reported. The method overrides an unmappedTargetPolicy set in a central configuration set by config()
        Returns:
        The reporting policy for unmapped target properties.
        Default:
        org.mapstruct.ReportingPolicy.WARN
      • componentModel

        public abstract String componentModel
        Specifies the component model to which the generated mapper should adhere. Supported values are
        • default: the mapper uses no component model, instances are typically retrieved via Mappers.getMapper(Class)
        • cdi: the generated mapper is an application-scoped CDI bean and can be retrieved via @Inject
        • spring: the generated mapper is a Spring bean and can be retrieved via @Autowired
        • jsr330: the generated mapper is annotated with @Named and can be retrieved via @Inject
        The method overrides an unmappedTargetPolicy set in a central configuration set by config()
        Returns:
        The component model for the generated mapper.
        Default:
        "default"
      • implementationName

        public abstract String implementationName
        Specifies the name of the implementation class. The <CLASS_NAME> will be replaced by the interface/abstract class name.

        Defaults to postfixing the name with Impl: <CLASS_NAME>Impl

        Returns:
        The implementation name.
        See Also:
        implementationPackage()
        Default:
        "<CLASS_NAME>Impl"
      • implementationPackage

        public abstract String implementationPackage
        Specifies the target package for the generated implementation. The <PACKAGE_NAME> will be replaced by the interface's or abstract class' package.

        Defaults to using the same package as the mapper interface/abstract class

        Returns:
        the implementation package.
        See Also:
        implementationName()
        Default:
        "<PACKAGE_NAME>"
      • config

        public abstract Class<?> config
        A class annotated with MapperConfig which should be used as configuration template. Any settings given via Mapper will take precedence over the settings from the referenced configuration source. The list of referenced mappers will contain all mappers given via uses() and MapperConfig.uses().
        Returns:
        A class which should be used as configuration template.
        Default:
        void.class
      • collectionMappingStrategy

        public abstract CollectionMappingStrategy collectionMappingStrategy
        The strategy to be applied when propagating the value of collection-typed properties. By default, only JavaBeans accessor methods (setters or getters) will be used, but it is also possible to invoke a corresponding adder method for each element of the source collection (e.g. orderDto.addOrderLine()).

        Any setting given for this attribute will take precedence over MapperConfig.collectionMappingStrategy(), if present.

        Returns:
        The strategy applied when propagating the value of collection-typed properties.
        Default:
        org.mapstruct.CollectionMappingStrategy.ACCESSOR_ONLY
      • nullValueMappingStrategy

        public abstract NullValueMappingStrategy nullValueMappingStrategy
        The strategy to be applied when null is passed as source value to the methods of this mapper. If no strategy is configured, the strategy given via MapperConfig.nullValueMappingStrategy() will be applied, using NullValueMappingStrategy.RETURN_NULL by default.
        Returns:
        The strategy to be applied when null is passed as source value to the methods of this mapper.
        Default:
        org.mapstruct.NullValueMappingStrategy.RETURN_NULL

Copyright © 2012–2015. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14