use of org.mapstruct.ap.internal.model.source.IterableMappingOptions in project mapstruct by mapstruct.
the class MethodRetrievalProcessor method getMethodRequiringImplementation.
private SourceMethod getMethodRequiringImplementation(ExecutableType methodType, ExecutableElement method, List<Parameter> parameters, boolean containsTargetTypeParameter, MapperOptions mapperOptions, List<SourceMethod> prototypeMethods, TypeElement mapperToImplement) {
Type returnType = typeFactory.getReturnType(methodType);
List<Type> exceptionTypes = typeFactory.getThrownTypes(methodType);
List<Parameter> sourceParameters = Parameter.getSourceParameters(parameters);
List<Parameter> contextParameters = Parameter.getContextParameters(parameters);
Parameter targetParameter = extractTargetParameter(parameters);
Type resultType = selectResultType(returnType, targetParameter);
boolean isValid = checkParameterAndReturnType(method, sourceParameters, targetParameter, contextParameters, resultType, returnType, containsTargetTypeParameter);
if (!isValid) {
return null;
}
ParameterProvidedMethods contextProvidedMethods = retrieveContextProvidedMethods(contextParameters, mapperToImplement, mapperOptions);
BeanMappingOptions beanMappingOptions = BeanMappingOptions.getInstanceOn(BeanMappingGem.instanceOn(method), mapperOptions, method, messager, typeUtils, typeFactory);
RepeatableMappings repeatableMappings = new RepeatableMappings();
Set<MappingOptions> mappingOptions = repeatableMappings.getMappings(method, beanMappingOptions);
IterableMappingOptions iterableMappingOptions = IterableMappingOptions.fromGem(IterableMappingGem.instanceOn(method), mapperOptions, method, messager, typeUtils);
MapMappingOptions mapMappingOptions = MapMappingOptions.fromGem(MapMappingGem.instanceOn(method), mapperOptions, method, messager, typeUtils);
EnumMappingOptions enumMappingOptions = EnumMappingOptions.getInstanceOn(method, mapperOptions, enumTransformationStrategies, messager);
// We want to get as much error reporting as possible.
// If targetParameter is not null it means we have an update method
SubclassValidator subclassValidator = new SubclassValidator(messager, typeUtils);
Set<SubclassMappingOptions> subclassMappingOptions = getSubclassMappings(sourceParameters, targetParameter != null ? null : resultType, method, beanMappingOptions, subclassValidator);
return new SourceMethod.Builder().setExecutable(method).setParameters(parameters).setReturnType(returnType).setExceptionTypes(exceptionTypes).setMapper(mapperOptions).setBeanMappingOptions(beanMappingOptions).setMappingOptions(mappingOptions).setIterableMappingOptions(iterableMappingOptions).setMapMappingOptions(mapMappingOptions).setValueMappingOptionss(getValueMappings(method)).setEnumMappingOptions(enumMappingOptions).setSubclassMappings(subclassMappingOptions).setSubclassValidator(subclassValidator).setTypeUtils(typeUtils).setTypeFactory(typeFactory).setPrototypeMethods(prototypeMethods).setContextProvidedMethods(contextProvidedMethods).setVerboseLogging(options.isVerbose()).build();
}
Aggregations