private Mapper getMapper(
      TypeElement element, MapperConfiguration mapperConfig, List<SourceMethod> methods) {
    List<MapperReference> mapperReferences = mappingContext.getMapperReferences();
    List<MappingMethod> mappingMethods = getMappingMethods(mapperConfig, methods);
    mappingMethods.addAll(mappingContext.getUsedVirtualMappings());
    mappingMethods.addAll(mappingContext.getMappingsToGenerate());

    Mapper mapper =
        new Mapper.Builder()
            .element(element)
            .mappingMethods(mappingMethods)
            .mapperReferences(mapperReferences)
            .options(options)
            .versionInformation(versionInformation)
            .decorator(
                getDecorator(
                    element,
                    methods,
                    mapperConfig.implementationName(),
                    mapperConfig.implementationPackage()))
            .typeFactory(typeFactory)
            .elementUtils(elementUtils)
            .extraImports(getExtraImports(element))
            .implName(mapperConfig.implementationName())
            .implPackage(mapperConfig.implementationPackage())
            .build();

    return mapper;
  }