Class MappingResolverImpl.ResolvingAttempt
- java.lang.Object
-
- org.mapstruct.ap.internal.processor.creation.MappingResolverImpl.ResolvingAttempt
-
- Enclosing class:
- MappingResolverImpl
private class MappingResolverImpl.ResolvingAttempt extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<BuiltInMethod>builtInsprivate ForgedMethodHistorydescriptionprivate java.util.function.Supplier<Assignment>forgerprivate FormattingParametersformattingParametersprivate MethodmappingMethodprivate FormattingMessagermessagerprivate java.util.List<Method>methodsprivate javax.lang.model.element.AnnotationMirrorpositionHintprivate intreportingLimitAmbiguousprivate SelectionCriteriaselectionCriteriaprivate SourceRHSsourceRHSprivate java.util.Set<SupportingMappingMethod>supportingMethodCandidates
-
Constructor Summary
Constructors Modifier Constructor Description privateResolvingAttempt(java.util.List<Method> sourceModel, Method mappingMethod, ForgedMethodHistory description, FormattingParameters formattingParameters, SourceRHS sourceRHS, SelectionCriteria criteria, javax.lang.model.element.AnnotationMirror positionHint, java.util.function.Supplier<Assignment> forger, java.util.List<BuiltInMethod> builtIns, FormattingMessager messager, boolean verboseLogging)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallow2Steps()private booleanallowConversion()private booleanallowDirect(Type type)private booleanallowDirect(Type sourceType, Type targetType)private booleanallowMappingMethod()private <T extends Method>
java.util.List<T>filterPossibleCandidateMethods(java.util.List<T> candidateMethods, T mappingMethod)private <T extends Method>
java.util.List<SelectedMethod<T>>getBestMatch(java.util.List<T> methods, Type source, Type target)private AssignmentgetTargetAssignment(Type sourceType, Type targetType)private booleanhasCompatibleCopyConstructor(Type sourceType, Type targetType)Whether the given target type has a single-argument constructor which accepts the given source type.private booleanhasQualfiers()private booleanisAssignableThroughCollectionCopyConstructor(Type sourceType, Type targetType)Whether the given source and target type are both a collection type or both a map type and the source value can be propagated via a copy constructor.private booleanisCandidateForMapping(Method methodCandidate)private booleanisCreateMethodForMapping(Method methodCandidate)private <T extends Method>
booleanisNotSelfOrSelfAllowed(T mappingMethod, T candidate)private booleanisUpdateMethodForMapping(Method methodCandidate)private <T extends Method>
java.lang.Stringjoin(java.util.List<SelectedMethod<T>> candidates)private voidprintQualifierMessage(SelectionCriteria selectionCriteria)private <T extends Method>
voidreportErrorWhenAmbiguous(java.util.List<SelectedMethod<T>> candidates, Type target)private MappingResolverImpl.ConversionAssignmentresolveViaConversion(Type sourceType, Type targetType)private AssignmenttoBuildInRef(SelectedMethod<BuiltInMethod> selectedMethod)private AssignmenttoMethodRef(SelectedMethod<Method> selectedMethod)
-
-
-
Field Detail
-
mappingMethod
private final Method mappingMethod
-
description
private final ForgedMethodHistory description
-
methods
private final java.util.List<Method> methods
-
selectionCriteria
private final SelectionCriteria selectionCriteria
-
sourceRHS
private final SourceRHS sourceRHS
-
formattingParameters
private final FormattingParameters formattingParameters
-
positionHint
private final javax.lang.model.element.AnnotationMirror positionHint
-
forger
private final java.util.function.Supplier<Assignment> forger
-
builtIns
private final java.util.List<BuiltInMethod> builtIns
-
messager
private final FormattingMessager messager
-
reportingLimitAmbiguous
private final int reportingLimitAmbiguous
-
supportingMethodCandidates
private final java.util.Set<SupportingMappingMethod> supportingMethodCandidates
-
-
Constructor Detail
-
ResolvingAttempt
private ResolvingAttempt(java.util.List<Method> sourceModel, Method mappingMethod, ForgedMethodHistory description, FormattingParameters formattingParameters, SourceRHS sourceRHS, SelectionCriteria criteria, javax.lang.model.element.AnnotationMirror positionHint, java.util.function.Supplier<Assignment> forger, java.util.List<BuiltInMethod> builtIns, FormattingMessager messager, boolean verboseLogging)
-
-
Method Detail
-
filterPossibleCandidateMethods
private <T extends Method> java.util.List<T> filterPossibleCandidateMethods(java.util.List<T> candidateMethods, T mappingMethod)
-
isNotSelfOrSelfAllowed
private <T extends Method> boolean isNotSelfOrSelfAllowed(T mappingMethod, T candidate)
-
getTargetAssignment
private Assignment getTargetAssignment(Type sourceType, Type targetType)
-
hasQualfiers
private boolean hasQualfiers()
-
printQualifierMessage
private void printQualifierMessage(SelectionCriteria selectionCriteria)
-
allowDirect
private boolean allowDirect(Type type)
-
allowConversion
private boolean allowConversion()
-
allowMappingMethod
private boolean allowMappingMethod()
-
allow2Steps
private boolean allow2Steps()
-
resolveViaConversion
private MappingResolverImpl.ConversionAssignment resolveViaConversion(Type sourceType, Type targetType)
-
isCandidateForMapping
private boolean isCandidateForMapping(Method methodCandidate)
-
isCreateMethodForMapping
private boolean isCreateMethodForMapping(Method methodCandidate)
-
isUpdateMethodForMapping
private boolean isUpdateMethodForMapping(Method methodCandidate)
-
getBestMatch
private <T extends Method> java.util.List<SelectedMethod<T>> getBestMatch(java.util.List<T> methods, Type source, Type target)
-
reportErrorWhenAmbiguous
private <T extends Method> void reportErrorWhenAmbiguous(java.util.List<SelectedMethod<T>> candidates, Type target)
-
toMethodRef
private Assignment toMethodRef(SelectedMethod<Method> selectedMethod)
-
toBuildInRef
private Assignment toBuildInRef(SelectedMethod<BuiltInMethod> selectedMethod)
-
isAssignableThroughCollectionCopyConstructor
private boolean isAssignableThroughCollectionCopyConstructor(Type sourceType, Type targetType)
Whether the given source and target type are both a collection type or both a map type and the source value can be propagated via a copy constructor.
-
hasCompatibleCopyConstructor
private boolean hasCompatibleCopyConstructor(Type sourceType, Type targetType)
Whether the given target type has a single-argument constructor which accepts the given source type.- Parameters:
sourceType- the source typetargetType- the target type- Returns:
trueif the target type has a constructor accepting the given source type,falseotherwise.
-
join
private <T extends Method> java.lang.String join(java.util.List<SelectedMethod<T>> candidates)
-
-