@Override public Mapper process( ProcessorContext context, TypeElement mapperTypeElement, List<SourceMethod> sourceModel) { this.elementUtils = context.getElementUtils(); this.typeUtils = context.getTypeUtils(); this.messager = context.getMessager(); this.options = context.getOptions(); this.versionInformation = context.getVersionInformation(); this.typeFactory = context.getTypeFactory(); MapperConfiguration mapperConfig = MapperConfiguration.getInstanceOn(mapperTypeElement); List<MapperReference> mapperReferences = initReferencedMappers(mapperTypeElement, mapperConfig); MappingBuilderContext ctx = new MappingBuilderContext( typeFactory, elementUtils, typeUtils, messager, options, new MappingResolverImpl( messager, elementUtils, typeUtils, typeFactory, sourceModel, mapperReferences), mapperTypeElement, sourceModel, mapperReferences); this.mappingContext = ctx; return getMapper(mapperTypeElement, mapperConfig, sourceModel); }
private SortedSet<Type> getExtraImports(TypeElement element) { SortedSet<Type> extraImports = new TreeSet<Type>(); MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn(element); for (TypeMirror extraImport : mapperConfiguration.imports()) { Type type = typeFactory.getType(extraImport); extraImports.add(type); } // Add original package if a dest package has been set if (!"default".equals(mapperConfiguration.implementationPackage())) { extraImports.add(typeFactory.getType(element)); } return extraImports; }