Package org.mapstruct
MapStruct is a code generator which simplifies the implementation of mappings between Java bean types by generating mapping code at compile time, following a convention-over-configuration approach. The generated code uses plain method invocations and thus is fast and type-safe.
This package contains several annotations which allow to configure how mapper interfaces are generated.
- See Also:
- MapStruct reference documentation
-
Class Summary Class Description MappingConstants Contains all constants defined in the mapping process.MappingConstants.ComponentModel Specifies the component model constants to which the generated mapper should adhere. -
Enum Summary Enum Description CollectionMappingStrategy Strategy for propagating the value of collection-typed properties from source to target.ConditionStrategy Strategy for defining what to what a condition (check) method is applied toInjectionStrategy Strategy for handling injection.MappingInheritanceStrategy Strategy for inheriting configurations given for methods of prototype mapping methods (declared on mapper config classes) to actual mapping methods declared on mappers referring to such config class viaMapper.config()
.NullValueCheckStrategy Strategy for dealing with null source values.NullValueMappingStrategy Strategy for dealing withnull
values passed to mapping methods.NullValuePropertyMappingStrategy Strategy for dealing withnull
or not present properties in the source bean.ReportingPolicy Policy for reporting issues occurring during the generation of a mapper implementation.SubclassExhaustiveStrategy Strategy for dealing with subclassMapping annotated methods. -
Annotation Types Summary Annotation Type Description AfterMapping Marks a method to be invoked at the end of a generated mapping method, right before the lastreturn
statement of the mapping method.AnnotateWith This can be used to have mapstruct generate additional annotations on classes/methods.AnnotateWith.Element Used in combination withAnnotateWith
to configure the annotation elements.AnnotateWiths This can be used to have mapstruct generate additional annotations on classes/methods.BeanMapping Configures the mapping between two bean types.BeforeMapping Marks a method to be invoked at the beginning of a generated mapping method.Builder Configuration of builders, e.g. the name of the final build method.Condition This annotation marks a method as a presence check method to check for presence in beans or it can be used to define additional check methods for something like source parameters.Context Marks a parameter of a method to be treated as mapping context.DecoratedWith Specifies a decorator to be applied to a generated mapper, which e.g. can be used to amend mappings performed by generated mapping methods.EnumMapping Configured the mapping between two value types.InheritConfiguration Advises the code generator to apply the configuration (as given viaMapping
,IterableMapping
etc.)InheritInverseConfiguration Advises the code generator to apply all theMapping
s from an inverse mapping method to the annotated method as well.IterableMapping Configures the mapping between two iterable like types, e.g.Javadoc Allows the definition of Javadoc comments in the MapStructMapper
generated class.MapMapping Configures the mapping between two map types, e.g.Mapper Marks an interface or abstract class as a mapper and activates the generation of a implementation of that type via MapStruct.MapperConfig Marks a class or interface as configuration source for generated mappers.Mapping Configures the mapping of one bean attribute.Mappings Configures the mappings of several bean attributes.MappingTarget Declares a parameter of a mapping method to be the target of the mapping.Named Marks mapping methods with the given qualifier name.ObjectFactory This annotation marks a method as a factory method to create beans.Qualifier Declares an annotation type to be a qualifier.SourceParameterCondition This annotation marks a method as a check method to check if a source parameter needs to be mapped.SourcePropertyName This annotation marks a presence check method parameter as a source property name parameter.SubclassMapping Configures the mapping to handle hierarchy of the source type.SubclassMappings Configures the SubclassMappings of several subclasses.TargetPropertyName This annotation marks a presence check method parameter as a target property name parameter.TargetType Declares a parameter of a custom mapping method to be populated with the target type of the mapping.ValueMapping Configures the mapping of source constant value to target constant value.ValueMappings Constructs a set of value (constant) mappings.