Package org.mapstruct.ap.spi
Interface MappingExclusionProvider
-
@Experimental("This SPI can have it\'s signature changed in subsequent releases") public interface MappingExclusionProvider
A service provider interface that is used to control if MapStruct is allowed to generate automatic sub-mapping for a givenTypeElement
. When generating the implementation of a mapping method, MapStruct will apply the following routine for each attribute pair in the source and target object:- If source and target attribute have the same type, the value will be simply copied from source to target. If the attribute is a collection (e.g. a `List`) a copy of the collection will be set into the target attribute.
- If source and target attribute type differ, check whether there is a another mapping method which has the type of the source attribute as parameter type and the type of the target attribute as return type. If such a method exists it will be invoked in the generated mapping implementation.
- If no such method exists MapStruct will look whether a built-in conversion for the source and target type of the attribute exists. If this is the case, the generated mapping code will apply this conversion.
- If no such method was found MapStruct will try to generate an automatic sub-mapping method that will do the mapping between the source and target attributes
- If MapStruct could not create a name based mapping method an error will be raised at build time, indicating the non-mappable attribute and its path.
- Since:
- 1.2
- Author:
- Filip Hrisafov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isExcluded(TypeElement typeElement)
Checks if MapStruct should not generate an automatic sub-mapping for the providedTypeElement
, i.e.
-
-
-
Method Detail
-
isExcluded
boolean isExcluded(TypeElement typeElement)
Checks if MapStruct should not generate an automatic sub-mapping for the providedTypeElement
, i.e. MapStruct will not try to descent into this class and won't try to automatically map it with some other type. The giventypeElement
will be excluded from the automatic sub-mapping generation- Parameters:
typeElement
- that needs to be checked- Returns:
true
if MapStruct should exclude the providedTypeElement
from an automatic sub-mapping
-
-