【发布时间】:2020-07-03 22:42:32
【问题描述】:
Class Source {
private String type;
private Object identifier;
}
标识符可以是 AppointmentIdentifier 或 JobIdentifier 类的对象; 我必须将 Source 映射到 Target,它具有以下结构。
Class Target {
private String type;
private Object identifierBO;
}
标识符BO 可以是AppointmentIdentifierBO 或JobIdentifierBO 类的对象。 下面是我的 Mapper 类:
@Mapper
public interface ModelMapper {
Target toTarget(@NonNull final Source source);
AppointmentIdentifierBO toAppointmentIdentifierBO(AppointmentIdentifier appointmentIdentifier);
JobBO toJobBO(JobIdentifier jobIdentifier);
}
我知道,我缺少一些有助于将标识符映射到标识符BO 的配置,但我无能为力。
【问题讨论】: