Class MappingResolverImpl
- java.lang.Object
-
- org.mapstruct.ap.internal.processor.creation.MappingResolverImpl
-
- All Implemented Interfaces:
MappingBuilderContext.MappingResolver
public class MappingResolverImpl extends java.lang.Object implements MappingBuilderContext.MappingResolver
The one and only implementation ofMappingBuilderContext.MappingResolver. The class has been split into an interface an implementation for the sake of avoiding package dependencies. Specifically, this implementation refers to classes which should not be exposed to themodelpackage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMappingResolverImpl.BestMatchTypeprivate static classMappingResolverImpl.ConversionAssignmentprivate static classMappingResolverImpl.ConversionMethod<T extends Method>Suppose mapping required from A to C and: there is a conversion from A to B, conversionX there is a method from B to C, methodY then this method tries to resolve this combination and make a mapping methodY( conversionX ( parameter ) ) Instead of directly using a built in method candidate, all the return types as 'B' of all available built-in methods are used to resolve a mapping (assignment) from result type to 'B'.private static classMappingResolverImpl.MethodConversion<T extends Method>Suppose mapping required from A to C and: there is a method from A to B, methodX there is a conversion from B to C, conversionY then this method tries to resolve this combination and make a mapping conversionY( methodX ( parameter ) ) Instead of directly using a built in method candidate, all the return types as 'B' of all available built-in methods are used to resolve a mapping (assignment) from source type to 'B'.private static classMappingResolverImpl.MethodMethod<T1 extends Method,T2 extends Method>Suppose mapping required from A to C and: no direct referenced mapping method either built-in or referenced is available from A to C no conversion is available there is a method from A to B, methodX there is a method from B to C, methodY then this method tries to resolve this combination and make a mapping methodY( methodX ( parameter ) ) NOTE method X cannot be an update methodprivate classMappingResolverImpl.ResolvingAttempt
-
Field Summary
Fields Modifier and Type Field Description private BuiltInMappingMethodsbuiltInMethodsprivate Conversionsconversionsprivate static java.lang.StringJL_OBJECT_NAMEprivate static intLIMIT_REPORTING_AMBIGUOUSprivate java.util.List<MapperReference>mapperReferencesprivate FormattingMessagermessagerprivate MethodSelectorsmethodSelectorsprivate java.util.List<Method>sourceModelprivate TypeFactorytypeFactoryprivate TypeUtilstypeUtilsprivate java.util.Set<Field>usedSupportedFieldsPrivate fields which are added to map certain property types.private java.util.Set<SupportingMappingMethod>usedSupportedMappingsPrivate methods which are not present in the original mapper interface and are added to map certain property types.private booleanverboseLogging
-
Constructor Summary
Constructors Constructor Description MappingResolverImpl(FormattingMessager messager, ElementUtils elementUtils, TypeUtils typeUtils, TypeFactory typeFactory, java.util.List<Method> sourceModel, java.util.List<MapperReference> mapperReferences, boolean verboseLogging)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MapperReferencefindMapperReference(Method method)AssignmentgetTargetAssignment(Method mappingMethod, ForgedMethodHistory description, Type targetType, FormattingParameters formattingParameters, SelectionCriteria criteria, SourceRHS sourceRHS, javax.lang.model.element.AnnotationMirror positionHint, java.util.function.Supplier<Assignment> forger)returns a parameter assignmentjava.util.Set<Field>getUsedSupportedFields()java.util.Set<SupportingMappingMethod>getUsedSupportedMappings()
-
-
-
Field Detail
-
LIMIT_REPORTING_AMBIGUOUS
private static final int LIMIT_REPORTING_AMBIGUOUS
- See Also:
- Constant Field Values
-
messager
private final FormattingMessager messager
-
typeUtils
private final TypeUtils typeUtils
-
typeFactory
private final TypeFactory typeFactory
-
sourceModel
private final java.util.List<Method> sourceModel
-
mapperReferences
private final java.util.List<MapperReference> mapperReferences
-
conversions
private final Conversions conversions
-
builtInMethods
private final BuiltInMappingMethods builtInMethods
-
methodSelectors
private final MethodSelectors methodSelectors
-
verboseLogging
private final boolean verboseLogging
-
JL_OBJECT_NAME
private static final java.lang.String JL_OBJECT_NAME
-
usedSupportedMappings
private final java.util.Set<SupportingMappingMethod> usedSupportedMappings
Private methods which are not present in the original mapper interface and are added to map certain property types.
-
usedSupportedFields
private final java.util.Set<Field> usedSupportedFields
Private fields which are added to map certain property types.
-
-
Constructor Detail
-
MappingResolverImpl
public MappingResolverImpl(FormattingMessager messager, ElementUtils elementUtils, TypeUtils typeUtils, TypeFactory typeFactory, java.util.List<Method> sourceModel, java.util.List<MapperReference> mapperReferences, boolean verboseLogging)
-
-
Method Detail
-
getTargetAssignment
public Assignment getTargetAssignment(Method mappingMethod, ForgedMethodHistory description, Type targetType, FormattingParameters formattingParameters, SelectionCriteria criteria, SourceRHS sourceRHS, javax.lang.model.element.AnnotationMirror positionHint, java.util.function.Supplier<Assignment> forger)
Description copied from interface:MappingBuilderContext.MappingResolverreturns a parameter assignment- Specified by:
getTargetAssignmentin interfaceMappingBuilderContext.MappingResolver- Parameters:
mappingMethod- target mapping methoddescription- the description sourcetargetType- return type to matchformattingParameters- used for formatting dates and numberscriteria- parameters criteria in the selection processsourceRHS- source informationpositionHint- the mirror for reporting problemsforger- the supplier of the callback method to forge a method- Returns:
- an assignment to a method parameter, which can either be:
- MethodReference
- TypeConversion
- SourceRHS Assignment (empty TargetAssignment)
- null, no assignment found
-
getUsedSupportedMappings
public java.util.Set<SupportingMappingMethod> getUsedSupportedMappings()
- Specified by:
getUsedSupportedMappingsin interfaceMappingBuilderContext.MappingResolver
-
getUsedSupportedFields
public java.util.Set<Field> getUsedSupportedFields()
- Specified by:
getUsedSupportedFieldsin interfaceMappingBuilderContext.MappingResolver
-
findMapperReference
private MapperReference findMapperReference(Method method)
-
-