Orika 使用 BoundMapperFacade 而不是 MapperFacade

Orika using BoundMapperFacade instead of MapperFacade

Orika Performance Tuning 指南说

  1. BoundMapperFacadeMapperFacade &
  2. 更高效
  3. 使用 BoundMapperFacade 的非循环版本。

我的代码如下所示

System.setProperty(OrikaSystemProperties.WRITE_SOURCE_FILES, "false");
System.setProperty(OrikaSystemProperties.WRITE_CLASS_FILES, "false");

MapperFactory factory = new DefaultMapperFactory.Builder().build();

//Then during initialization quite a few code is added to classMap like below with all the classes non cyclic

factory.classMap(Folder.class, FolderUI.class).byDefault().register();
factory.classMap(VCManager.class, VCManagerUI.class).byDefault().register();
factory.classMap(NSXManager.class, NSXManagerUI.class).byDefault().register();
factory.classMap(L3SwitchManager.class, BaseManagerUI.class).byDefault().register();

...

MapperFacade mapper = factory.getMapperFacade();

每当我需要查找时,我都会做 mapper.map(input, output)

谁能告诉我在这种情况下如何使用 BoundedMapperFacade,因为我在 MapperFacade 中没有看到任何 getBoundedMapperFacade

Orika 版本 - 1.4.2

MapperFactory 通过决定参数为您提供正确的 class。如果将方法 getMapperFacade() 与要映射的 class 和要映射到的 class 一起使用,它会为您提供 BoundMapperFacade:

BoundMapperFacade<From,To> mapper = mapperFactory.getMapperFacade(From.class, To.class);