在Orika中有可能吗?这两个类都有2个源对象和目标作为实例属性。
示例:
public class Destination {
private String loginId;
private Integer contactId;}
public class LoginDetails {
private String loginId;
private String clientId;
}
public class AlertEntityIdentity {
private Integer contactId;
}
答案 0 :(得分:0)
mapperFactory.classMap(LoginDetails.class, Destination.class)
.byDefault().register();
mapperFactory.classMap(AlertEntityIdentity.class, Destination.class)
.byDefault().register();
假设您有loginDetails
和alertEntityIdentity
。
Destination destination = mapperFacade.map(loginDetails, Destination.class);
mapperFacade.map(alertEntityIdentity, destination);// this will update contactId in destination